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.

Idle timer

Featured Replies

Hi all,

 

basically my script does things after its been idle for too long. I've tried multiple things on this idle timer and I can't seem to get it to function properly. On script start it works properly, but after grabbing an item, this idle function no longer starts ticking the idle timer. 

			if (!myPlayer().isMoving() && item == null) {
				logB = "Idle";
				newTime = (System.currentTimeMillis() - idleTime);
				if (newTime >= 30000) {
					//stuff
                                        idleTime = (System.currentTimeMillis());
				}
			}

the item should/is updating everytime the state loops

Edited by Mushphang

Hi all,

 

basically my script does things after its been idle for too long. I've tried multiple things on this idle timer and I can't seem to get it to function properly. On script start it works properly, but after grabbing an item, this idle function no longer starts ticking the idle timer. 

			if (!myPlayer().isMoving() && item == null) {
				logB = "Idle";
				newTime = (System.currentTimeMillis() - idleTime);
				if (newTime >= 30000) {
					//stuff
                                        idleTime = (System.currentTimeMillis());
				}
			}

the item should/is updating everytime the state loops

 

Problem could be the item not being null but the player not moving. Don't really know the specifics for this but what I usually do is:

 

	if (myPlayer().isMoving()) {
             // Reset the timer if the player is moving
             idleTime = System.currentTimeMillis();
        } 
         
        newTime = (System.currentTimeMillis() - idleTime);
        if (newTime >= 30000) {
           //stuff
           idleTime = (System.currentTimeMillis());
         }
			

If everything is going well, reset the idleTime. If things are not going well then it will do something after 30 seconds and reset the timer

Edited by nosepicker

  • Author

Problem could be the item not being null but the player not moving. Don't really know the specifics for this but what I usually do is:

 

	if (myPlayer().isMoving()) {
             // Reset the timer if the player is moving
             idleTime = System.currentTimeMillis();
        } 
         
        newTime = (System.currentTimeMillis() - idleTime);
        if (newTime >= 30000) {
           //stuff
           idleTime = (System.currentTimeMillis());
         }
			

If everything is going well, reset the idleTime. If things are not going well then it will do something after 30 seconds and reset the timer

 

Will test it out! Thanks smile.png

 

So far so good, can't believe I was stumped on it for so long when it was that easy of a fix. Got so fixated on !myPlayer.isMoving() I guess.

Edited by Mushphang

Here's what i use to keep my mule logged in. I just set it to move the camera every 250 seconds. 

 public void onStart() {       
        timer = System.currentTimeMillis();
 }
 
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ case code 
 if(System.currentTimeMillis() - timer >= 250000) {
        status = "moving camera";
        int currentYaw = getCamera().getYawAngle();
        getCamera().moveYaw(currentYaw + (random(-50, 70)));
        timer = System.currentTimeMillis();
 }

Could use a failsafe incase the degrees changed = 0. Worst case scenario it gets logged out and osbot logs it back in and continues. 

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.