Jump to content

Loot out of screen


IkiritokunI

Recommended Posts

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 
        }
    }
}

 

Link to comment
Share on other sites

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

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...