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.

Interact with all items in the inventory given a name

Featured Replies

I'm making a combat script right now which kill mobs, and if the user requests it will pick up bones and bury them. I wait for the inventory to fill up and then do a check for all of the drop / banking needs of the script.

 

I want to make a method which will work for future uses as well and you can just give it a specific item and interact option and it will iterate over each item in the inventory and execute the interact command.

 

Currently the script has a problem where it will detect all of the bones, it will do the interact command but it gets way ahead of its self. Say if the inventory has 6 bones, it will spam click really bad on the first bone, and sometimes click the second bone and just stop.

 

I didn't want to use a while loop checking to make sure the inventory doesn't have anymore of that item in it since I wanted to make this method as I said more robust and not just for burying bones. So I can use it for multiple commands whenever they come up besides just burying.

 

I was wondering if there's a more elegant way of making sure the command has executed through the client vs just doing random sleeping amounts and hoping the script doesn't miss an item.

Edited by Nebulae

Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value :)

Edit; eg:

if inventory contains bones

oldBones = inventory.getitem("bones").getAmount();

8nventory,".getitem("bones").interact("bury");

new ConditionalSleep(2000) {

@ Override

public boolean condition() throws InterruptedException {

return oldBones > inventory.getitem("bones").getamount;

}

}.sleep();

Sry for text wrote on phone

Edited by IHB

  • Author

Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value smile.png

 

Wow, thanks for this can't believe I never thought of that.

Use conditional sleeps when u bury each bone, eg store the valur of bones in inventory then click and wait until the amount of bones in invent is less than the stored value smile.png

Edit; eg:

if inventory contains bones

oldBones = inventory.getitem("bones").getAmount();

8nventory,".getitem("bones").interact("bury");

new ConditionalSleep(2000) {

@ Override

public boolean condition() throws InterruptedException {

return oldBones > inventory.getitem("bones").getamount;

}

}.sleep();

Sry for text wrote on phone

nailed it

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.