Jump to content

Loot out of screen


Recommended Posts

Posted

Dear great community ?

Making my first script, can any1 help me with this loot state?

Just writed the loot state and found a bug (when loot is out of screen) So he can't get the interact ''take''  but is true on minimap I want it the bot get to the loot. but I can not find the webwalk for it.

Any1 can help me?

private void loot() {
    final GroundItem BlueWizardHeadOrBeads = getGroundItems().closest(579);
    if (BlueWizardHeadOrBeads != null && BlueWizardHeadOrBeads.isVisible() && BlueWizardHeadOrBeads.interact("Take")){
        new ConditionalSleep(2000) {
            @Override
            public boolean condition() throws InterruptedException {
                return !BlueWizardHeadOrBeads.exists();
            }
        }.sleep();
    } else 
        }
    }
}

 

Posted

You should definitely consider using names instead of ID's for things like this, much easier for you to understand and correct errors when you read over it again.

GroundItem hat = getGroundItems().closest("Blue wizard hat");

if (hat != null) {
InteractionEvent pickup = new InteractionEvent(hat,"Take");
pickup.setWalkTo(true);
execute(pickup);
}

(Code was written in the browser & not tested)

You can use interaction events to walk to items, I wouldn't rely on it too heavily though.

There's also a lot of other things you can use InteractionEvents for, you should use this page on the API to see this.

https://osbot.org/api/org/osbot/rs07/event/InteractionEvent.html

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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