Jump to content

NEED HELP IN CONSTRUCTION SCRIPT


magoalucard

Recommended Posts

i need to write a construction script for my bots, but i need some help, because i'ts bugs alot 

Spoiler


    Area areapt = new Area(2955, 3226, 2950, 3221);
     private void doLarder() throws InterruptedException {
            RS2Object Larder = getObjects().closest("Larder space");
            RS2Object Portalf = getObjects().closest(15478);
            RS2Object Larder2 = getObjects().closest("Larder");
            RS2Widget Oak = getWidgets().getWidgetContainingText("Oak larder");
            if(!getMap().isInHouse() && areapt.contains(myPlayer().getPosition()) && Portalf.hasAction("Build mode") &&  Portalf.isVisible() && getInventory().getAmount("Oak plank") >= ? {
                Portalf.interact("Build mode");
                new ConditionalSleep (5000, 500) {
                    @Override
                    public boolean condition() {
                        return areapt.contains(myPlayer().getPosition());
                }
            }.sleep();
            }if(getMap().isInHouse() && !Larder.isVisible() && !myPlayer().isAnimating()) {
                getWalking().walk(Larder);
            } if (Larder.isVisible() && !myPlayer().isAnimating()) {
                Larder.interact("Build"); sleep(random(400,700));
                new ConditionalSleep (5000, 500) {
                    @Override
                    public boolean condition() {
                        return Oak.isVisible();
                }
            }.sleep();
             if(Oak.isVisible() || Oak != null  ) {
                getKeyboard().typeString("2"); log("building");
                new ConditionalSleep (5000, 500) {
                    @Override
                    public boolean condition() {
                        return !myPlayer().isAnimating();
                }
            }.sleep();
            }
     } if (Larder2.isVisible() && Larder2.hasAction("Remove")) {
         Larder2.interact("Remove"); sleep (random(600,700));
         getKeyboard().typeString("1");
     }
     }
        @Override
    public int onLoop() throws InterruptedException {
        if(skills.getStatic(Skill.CONSTRUCTION) > 33) {
            doLarder();
        }

when i build a new oak larder, this codes starts to send this logger notes and heavly lagging

 

Error in script executor!
java.lang.NullPointerException
    at Construction.doLarder(Construction.java:53)
    at Construction.onLoop(Construction.java:71)
    at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(kl:223)
    at java.lang.Thread.run(Unknown Source)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...