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.

Stop loop when smelting

Featured Replies

Title says it all,

 

Script interacts with furnace, chooses a bar and types a random number.

 

My question is, is there a specific way to stop that loop and continue after its done? or do I have to make some kind of timer.

 

cheers.

You need to make a system so it stops re-interacting while it is smelting. Sleeping for a long time is not a good idea. 

do {

 

sleep(10);
 

} while(myPlayer().isAnimating());

 

not the best way of doing it but it should work

do {

 

sleep(10);

 

} while(myPlayer().isAnimating());

 

not the best way of doing it but it should work

The animation stops between each bar that is smelted.

 

The best way to do this is to record the currentTimeMillis when the player is animating, then check if that recorded time has been increased by x amount of milliseconds, and if thats true then allow it to continue.

 

I can show you a snippet perhaps when I get home.

 private State getState() {
        if (inventory.isFull())
            return State.Bankrun     or whatever you are using

link to your Banking Enum... I think? im learning :D

Edited by Nightchillz

 private State getState() {

        if (inventory.isFull())

            return State.Bankrun     or whatever you are using

link to your Banking Enum... I think? im learning biggrin.png

Depending on what you smelt, you are never going to have a full inventory.

The animation stops between each bar that is smelted.

 

The best way to do this is to record the currentTimeMillis when the player is animating, then check if that recorded time has been increased by x amount of milliseconds, and if thats true then allow it to continue.

 

I can show you a snippet perhaps when I get home.

Just add a sleep long enough till it animates again if it will take 1 second for it to animate again add a sleep of 1000ms before the smelt method.

Just add a sleep long enough till it animates again if it will take 1 second for it to animate again add a sleep of 1000ms before the smelt method.

You would have to return out of the method, a simple method like this would work better

 

public boolean canAnimate(){
 
return System.currentTimeMillis() > (lastAnimation + 3000);
}

 

You would have to return out of the method, a simple method like this would work better

public boolean canAnimate(){
 
return System.currentTimeMillis() > (lastAnimation + 3000);
}

Yes, that would indeed be a better solution.

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.