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.

Timers(Help)

Featured Replies

Im not sure if this is correct section.

 

How do i create a timer? For woodcutter that H0ppy made, he made a timer but i cant seem to get that one to work? I need something to do like how many total chopped and total time running etc. Some help would be great! Thanks

Hello,

 

Well here is the code of the Timer again:

public class Timer {

	private long period;
	private long start;

	public Timer(long period) {
		this.period = period;
		start = System.currentTimeMillis();
	}

	public long getElapsed() {
		return System.currentTimeMillis() - start;
	}

	public long getRemaining() {
		return period - getElapsed();
	}

	public boolean isRunning() {
		return getElapsed() <= period;
	}

	public void reset() {
		start = System.currentTimeMillis();
	}

	public void stop() {
		period = 0;
	}

	public static String format(long ms) {
		long sec = ms / 1000L;
		return String.format(
				"%02d:%02d:%02d",
				new Object[] { Long.valueOf(sec / 3600L),
						Long.valueOf((sec % 3600L) / 60L),
						Long.valueOf(sec % 60L) });
	}
}

You create a new . java file which is called Timer biggrin.png

Then paste this inside it.

Now you can use a Timer object.

If you need more info or examples then add my skype wink.png

H0ppy

Edited by H0ppy

  • Author

Thank you all for responses and help!

Hello,
 
Well here is the code of the Timer again:

public class Timer {

	private long period;
	private long start;

	public Timer(long period) {
		this.period = period;
		start = System.currentTimeMillis();
	}

	public long getElapsed() {
		return System.currentTimeMillis() - start;
	}

	public long getRemaining() {
		return period - getElapsed();
	}

	public boolean isRunning() {
		return getElapsed() <= period;
	}

	public void reset() {
		start = System.currentTimeMillis();
	}

	public void stop() {
		period = 0;
	}

	public static String format(long ms) {
		long sec = ms / 1000L;
		return String.format(
				"%02d:%02d:%02d",
				new Object[] { Long.valueOf(sec / 3600L),
						Long.valueOf((sec % 3600L) / 60L),
						Long.valueOf(sec % 60L) });
	}
}


You create a new . java file which is called Timer biggrin.png
Then paste this inside it.
Now you can use a Timer object.

If you need more info or examples then add my skype wink.png

H0ppy

 

I will do when I get some more time in coming days, thank you! :D

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.