AdhesiveBandage Posted July 13, 2018 Share Posted July 13, 2018 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? Quote Link to comment Share on other sites More sharing options...
dreameo Posted July 13, 2018 Share Posted July 13, 2018 yea, just use a filter when doing closest and return ground items pos is within x area Quote Link to comment Share on other sites More sharing options...
AdhesiveBandage Posted July 13, 2018 Author Share Posted July 13, 2018 ill look into filters then. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Ragboys is back Posted July 13, 2018 Share Posted July 13, 2018 (edited) 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 July 13, 2018 by Ragboys is back Quote Link to comment Share on other sites More sharing options...
dreameo Posted July 13, 2018 Share Posted July 13, 2018 Here's how you go about doing it: Spoiler https://imgur.com/a/rWY17Uj If you're confused about how it looks, search up anonymous classes. 1 Quote Link to comment Share on other sites More sharing options...
AdhesiveBandage Posted July 13, 2018 Author Share Posted July 13, 2018 (edited) 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 July 13, 2018 by AdhesiveBandage 1 Quote Link to comment Share on other sites More sharing options...
AdhesiveBandage Posted July 13, 2018 Author Share Posted July 13, 2018 33 minutes ago, dreameo said: Here's how you go about doing it: Reveal hidden contents https://imgur.com/a/rWY17Uj If you're confused about how it looks, search up anonymous classes. Ya, I figured it out thanks for the Help! Quote Link to comment Share on other sites More sharing options...
Bankah Posted July 13, 2018 Share Posted July 13, 2018 Could you not just do: getGroundItems().closest(f -> f != null && myArea.contains(f)); and obviously any other filters you wanted to apply? Quote Link to comment Share on other sites More sharing options...
Juggles Posted July 13, 2018 Share Posted July 13, 2018 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 Quote Link to comment Share on other sites More sharing options...
AdhesiveBandage Posted July 13, 2018 Author Share Posted July 13, 2018 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. Quote Link to comment Share on other sites More sharing options...