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.

Checking Idle time?

Featured Replies

Is there any way to check how long the bot has been in Idle for? Say that i want my bot to do certain things, but in case it idles for say 7sec+ for etc, i want it to move position? 

Seems like you are doing something wrong or need to improve your script.

Why would you need to detect if you are idle for 7 seconds? Makes no sense to me

Edited by Explv

11 minutes ago, Explv said:

Seems like you are doing something wrong or need to improve your script.

Why would you need to detect if you are idle for 7 seconds? Makes no sense to me

I think like a failsafe or something. But 7 secs seems too low. E.g some scripts auto stops the script if no xp has been gained over a period of 7-10 minutes. In case it fucked up somewhere

8 minutes ago, Visty said:

I think like a failsafe or something. But 7 secs seems too low. E.g some scripts auto stops the script if no xp has been gained over a period of 7-10 minutes. In case it fucked up somewhere

You should probably aim for your script to not fuck up then

2 minutes ago, Explv said:

You should probably aim for your script to not fuck up then

True father :feels:

@slazter if you really have to do it, then you can probably make use of the isAnimating and isMoving methods in the Character class, in combination with some kind of timer.

Edited by Explv

Check plague doctor's cannonball maker he has something like that done for the sleep I think?

  • Author

Managed to solve it with something kind of what @Explv suggested,
 

if(myPlayer().isMoving() || myPlayer().isAnimating()){
                           time = System.currentTimeMillis();
                         }
                         else if(!myPlayer().isAnimating() && !myPlayer().isMoving()){
                           timeToMove=System.currentTimeMillis();
                           if(timeToMove>time+5000){
                             //Code
                           }
                         }
}

Mabye not the most elegant solution, but i gets the job done while i think of a better Solution :)

It's a good solution, just be clear on how you write it so you don't get confused later (variable naming).

time variables have to be global.

 

  private boolean idleFor(int millis){

        if(myPlayer().isAnimating() || myPlayer.isMoving())
        {
            timeSinceAction = System.currentTimeMillis();
        }
        else
        {
            timeSinceIdle = System.currentTimeMillis();
        }

        return timeSinceAction + millis < timeSinceIdle;
    }

 

Edited by dreameo

  • Author
17 hours ago, dreameo said:

It's a good solution, just be clear on how you write it so you don't get confused later (variable naming).

time variables have to be global.

 


  private boolean idleFor(int millis){

        if(myPlayer().isAnimating() || myPlayer.isMoving())
        {
            timeSinceAction = System.currentTimeMillis();
        }
        else
        {
            timeSinceIdle = System.currentTimeMillis();
        }

        return timeSinceAction + millis < timeSinceIdle;
    }

 

Hmm this was actually very neat, im gonna go ahead and save this snippet, thanks! :D

Yeah, there will be a lot of methods that you use often, keep them clean and separate. Reduces code duplication and makes life easier. 

Ex: a timer class 

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.