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.

inventory.contains slow?

Featured Replies

  • Author

Mine:

Called
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
Sleep
 

public boolean contains(int i) {
System.out.println("Called");
return true;
}
 
public void check() {
if (contains(0)) {
for (int i = 0; i < 100; i++) {
System.out.println("Sleep");
}
}
}

Yours

Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
Sleep
Called
 

public boolean contains(int i) {
System.out.println("Called");
return true;
}
 
public void check() {
for (int i = 0; i < 100 && contains(0); i++) {
System.out.println("Sleep");
}
}

Hypothetical, but yeah.

sure, but you are arguing over a minimal cpu hit which is not what i am asking.  I am asking why .contains is getting updated so late after the inventory has changed. calling it over should not affect what the output of the call is

 

 

and also:

 

yours says if inventory contains item:

 

sleep for 5 seconds, because there is no condition for the for statement except that i is less than 100.

Edited by Novak

The game only updates every tick (600 ms) so idk what you're idea is with checking after only 50 ms....

Also, Conditional sleeps exist for a reason.

Edited by Swizzbeat

so im a bit confused, what exactly are you trying to accomplish here? Your saying innvnetory.contains is slow? its a boolean what you mean. Are your rying to say the deposit method is slow?

  • Author

so im a bit confused, what exactly are you trying to accomplish here? Your saying innvnetory.contains is slow? its a boolean what you mean. Are your rying to say the deposit method is slow?

 

 

no.  

 

im saying the inventory.contains does not update its value(true/false) for a long time after it is actually true/false.

 

example:

 

i deposit item A into the bank from my inventory.

when the item disappears, inventory.contains should be false.

instead, it is still true for another couple seconds, slowing down the script

Edited by Novak

  • Author

thats sad to hear, but wouldnt the value change after it finishes looping? 

 

 

in the OP i state i am using a for loop that sleeps until inventory.contains is no longer true, so it wont exit that loop until it is false OR it times out at 5 seconds

in the OP i state i am using a for loop that sleeps until inventory.contains is no longer true, so it wont exit that loop until it is false OR it times out at 5 seconds

i meant shouldnt the value change after the onLoop finishes looping though? thats what i think. I never really had a problem with inventory.contains

Guest
This topic is now closed to further replies.

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.