Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NEED HELP IN CONSTRUCTION SCRIPT

Featured Replies

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)

9 hours ago, Dab in a Lab said:

Null check the Larder 

if (Larder != null)

       // You're code

// You are code

16 hours ago, Night said:

You should learn some basic Java before attempting to script.

Exactly. You are first using methods on an object and are then nullchecking it for example.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.