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 script

Featured Replies

I need idle script with runtime timer
I have 0 knowledge of making scripts.
Thanks in advance


@ScriptManifest(author = "Bacon", name = "idle", info = "", version = 0.0, logo = "")
public class Test extends Script {
    

    @Override
    public int onLoop() throws InterruptedException {

        return 100000;
    }


}

0 lines of code.

18 minutes ago, Tikvesa said:

yes, I use your script but i need runtime timer so i dont need to go to lumb and talk to Hans. Can you provide source of it or can you put timer by any chance?

oh an actual alarm timer not just showing time xd 

  • Author
14 minutes ago, FuryShark said:

oh an actual alarm timer not just showing time xd 

lol, are you gonna fix it?
I know you said in discord that u dont support old scripts anymore

15 hours ago, Tikvesa said:

lol, are you gonna fix it?
I know you said in discord that u dont support old scripts anymore

//This is the start time
long startTime = System.currentTimeMillis();


//Get run time in seconds - Use some other method to format it as hh:mm:ss
(System.currentTimeMillis() - startTime) / 1000

You can implement this code into the code @Nbaconsent

Edited by Medusa

  • Author
4 minutes ago, Medusa said:

//This is the start time
long startTime = System.currentTimeMillis();


//Get run time in seconds - Use some other method to format it as hh:mm:ss
(System.currentTimeMillis() - startTime) / 1000

You can implement this code into the code @Nbaconsent

yes i followed pugs tutorial for timer i got it working.
 

public class Main extends Script {
	private long timeBegan;
	private long timeRan;

	
	public void onStart(){
		timeBegan = System.currentTimeMillis();
		
	}
	
	public int waitTime(int min, int max) {
		return (int)(Math.random() * (max - min)) + min;
	}
	
	public int onLoop() throws InterruptedException {
		if (mouse.isOnScreen()) {
			mouse.moveOutsideScreen();
		} else {
			mouse.move((int)(100 + (Math.random() * 660)), (int)(100 + (Math.random() * 400)));
		}
		
		return waitTime(1000, 240000); //1 sec to 4 mins.
	}
	public void onPaint(Graphics2D g)
    {
      Graphics2D gr = g;
      timeRan = System.currentTimeMillis() - this.timeBegan; 
      g.drawString(ft(timeRan), 1, 250); 
    }
    public String ft(long duration) 
    {
        String res = "";
        long days = TimeUnit.MILLISECONDS.toDays(duration);
        long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
        long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
        long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
        if (days == 0) 
        {
            res = (hours + "h " + minutes + "m " + seconds+ "s ");
        } 
        else 
        {
            res = (days + "d " + hours + "h " + minutes + "m " + seconds+ "s ");
        }
        return res;
  
    }
        
 
 
}

This is my whole script and its working fine. Now im trying to log how long did script last for in console but i cant get time in h m s im getting it in pure ms. How to fix 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.