Jump to content
AdhesiveBandage

Need help keeping bot in specified area

Recommended Posts

Hello everybody, I recently decided to begin botting once more and thought it would be interesting to make some basic scripts. I am currently working on a looting script that will pick up items near varrock west bank and bank them. The issue is some items are found inside the G.E. walls and the bot will run inside and loot them then return to it's designated location. Is their anyway to prevent the bot from travelling outside of it's designated area entirely rather than running outside and returning?

Link to comment
Share on other sites

I don't really how to use filters, but I'd try something else before using/learning about filters

Something like

if(IsInLootingArea()){

loot;

}

else{

walkToLootingArea;

}

IsInLootingArea() is a boolean method that returns if your player is in the looting area. If true, it'll loot. Else, it'll walk there.

Would be something like this:

private boolean isInLootingArea(){
 return lootingArea.contains(myPosition());
}

Then you can add conditional sleeps and much more to make it a more complete script.

I'm kinda new to scripting, but if you're looking for help hit me up @ PM, I'll gladly help you with what I can

 

Edited by Ragboys is back
Link to comment
Share on other sites

1 hour ago, Ragboys is back said:

I don't really how to use filters, but I'd try something else before using/learning about filters

Something like


if(IsInLootingArea()){

loot;

}

else{

walkToLootingArea;

}

IsInLootingArea() is a boolean method that returns if your player is in the looting area. If true, it'll loot. Else, it'll walk there.

Would be something like this:


private boolean isInLootingArea(){
 return lootingArea.contains(myPosition());
}

Then you can add conditional sleeps and much more to make it a more complete script.

I'm kinda new to scripting, but if you're looking for help hit me up @ PM, I'll gladly help you with what I can

 

 

 

Caught me a little late, as I had already learned how to use a basic filter. It's actually pretty simple and you should definitely learn their functionality.

 

I shoved this into my onloop after defining my designated area:

 

Filter<GroundItem> LocationFilter = new Filter<GroundItem>()
{

    @Override
    public boolean match(GroundItem GroundItem)
    {
        return myArea.contains(GroundItem) ;
    }
};

I then ran this in my code 

GroundItem Loot = getGroundItems().closest(LocationFilter);

This ended up picking up all loot in the designated area which I will then have to include/exclude certain items at a later time.

Edited by AdhesiveBandage
  • Like 1
Link to comment
Share on other sites

8 hours ago, Bankah said:

Could you not just do:

 

getGroundItems().closest(f -> f != null && myArea.contains(f));

 

and obviously any other filters you wanted to apply?

 

1 hour ago, Juggles said:

Wow you guys are making this harder than it is.....

literally just do

GroundItem items = getGroundItems.().closest(AREA, "item names");

 

only takes one line to only loot in a specific area

Welp, future knowledge I guess. Thanks for the help.

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.

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