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.

VERY SIMPLE BREAKHANDLER

Featured Replies

So since I'm a retard and don't know where the fucking spoiler button is located, I'm posting code on pastebin.

 

BreakHandler code:

https://pastebin.com/raw/A6vG6u3B

 

Make a class and call it BreakManager, then drop that code in there. ezpz.

 

Then you can use it in your script like this.

https://pastebin.com/raw/9BHMK3kn

 

When you initialize the BreakManager in your onStart method, you gotta remember that it's set to hours. AKA

BreakManager bm = new BreakManager(1 hour, 1 hour);

(Don't actually write hour though)

You can change the time format yourself, but I just made it hours. Ok bye

3 minutes ago, Medusa said:

So since I'm a retard and don't know where the fucking spoiler button is located, I'm posting code on pastebin.

 

BreakHandler code:

https://pastebin.com/raw/A6vG6u3B

 

Make a class and call it BreakManager, then drop that code in there. ezpz.

 

Then you can use it in your script like this.

https://pastebin.com/raw/9BHMK3kn

 

When you initialize the BreakManager in your onStart method, you gotta remember that it's set to hours. AKA


BreakManager bm = new BreakManager(1 hour, 1 hour);

(Don't actually write hour though)

You can change the time format yourself, but I just made it hours. Ok bye

 

public class BreakManager {
	
	private long hours;
	private long rest;
	private long lastBreak;
	private long breakStart;
	private boolean isBreaking = false;
	
	public BreakManager(long play, long rest) {
		this.hours = (play * 3600);
		this.rest = (rest * 3600);
		this.lastBreak = System.currentTimeMillis();
	}
	
	public boolean shouldBreak() {
		if (isBreaking) {
			if (isBreakOver()) {
				System.out.println("Ending break");
				isBreaking = false;
				lastBreak = System.currentTimeMillis();
				return false;
			} else {
				return true;
			}
		} else {
			if (isTimeToBreak()) {
				isBreaking = true;
				breakStart = System.currentTimeMillis();
				System.out.println("Breaking.");
				return true;
			} else {
				return false;
			}
		}
	}
	
	public int getSecondsToBreak() {
		
		int time = (int) (hours - ((System.currentTimeMillis() - lastBreak) / 1000));
		
		return time;
	}
	
	public int getSecondsToBreakEnd() {
		
		int time = (int) (rest - ((System.currentTimeMillis() - breakStart) / 1000));
		
		return time;
	}
	
	public boolean isTimeToBreak() {
		return (System.currentTimeMillis() - lastBreak) / 1000 >= hours;
	}
	
	public boolean isBreakOver() {
		return (System.currentTimeMillis() - breakStart) / 1000 >= rest;
	}
	
}

Edited by Loque

Quote

(Don't actually write hour though)

l0l 

  • Author
14 minutes ago, Gunman said:

Think I would rather do the over ride break manager method lol. And yeah I think they got rid of the spoiler button haven't seen it in a while.

ngl I have no idea what that is

7 minutes ago, Medusa said:

ngl I have no idea what that is

private RandomSolver solver = new RandomSolver(RandomEvent.BREAK_MANAGER) {
        @Override
        public boolean shouldActivate() {
            return false;
        }

        @Override
        public int onLoop() throws InterruptedException {
            return 0;
        }
    };

Put this in onStart

 bot.getRandomExecutor().overrideOSBotRandom(solver);

 

10 minutes ago, Gunman said:

private RandomSolver solver = new RandomSolver(RandomEvent.BREAK_MANAGER) {
        @Override
        public boolean shouldActivate() {
            return false;
        }

        @Override
        public int onLoop() throws InterruptedException {
            return 0;
        }
    };

Put this in onStart


 bot.getRandomExecutor().overrideOSBotRandom(solver);

 

200iq

  • Author
27 minutes ago, Gunman said:

private RandomSolver solver = new RandomSolver(RandomEvent.BREAK_MANAGER) {
        @Override
        public boolean shouldActivate() {
            return false;
        }

        @Override
        public int onLoop() throws InterruptedException {
            return 0;
        }
    };

Put this in onStart


 bot.getRandomExecutor().overrideOSBotRandom(solver);

 

What are the chances of that working with randoms disabled? I'm guessing 0?

Edited by Medusa

  • Author
Just now, Gunman said:

It won't. Because it's part of the random solver.

No shit. That's why I made this thread.

  • 1 month later...
On 3/22/2020 at 7:04 AM, Medusa said:

ngl I have no idea what that is

-has no idea that you can override random solver

 

On 3/22/2020 at 7:41 AM, Medusa said:

What are the chances of that working with randoms disabled? I'm guessing 0?

-doesn't know how it would work if you were to override the random solver functionality, guy nicely answers him

 

On 3/22/2020 at 7:44 AM, Medusa said:

No shit. That's why I made this thread.

-condescending like he already knew at time of posting, when his prior statements show that he didn't know,  and he literally asked the dude

 

 

 

U ok bud? little hostile

1 hour ago, Roboman said:

-has no idea that you can override random solver

 

-doesn't know how it would work if you were to override the random solver functionality, guy nicely answers him

 

-condescending like he already knew at time of posting, when his prior statements show that he didn't know,  and he literally asked the dude

 

 

 

U ok bud? little hostile

No this is for if you're running CLI parameter norandoms, which disables all the solvers. He was right I was having brain malfunctions at the time because I was tired :feels:

  • Author
14 hours ago, Roboman said:

-has no idea that you can override random solver

 

-doesn't know how it would work if you were to override the random solver functionality, guy nicely answers him

 

-condescending like he already knew at time of posting, when his prior statements show that he didn't know,  and he literally asked the dude

 

 

 

U ok bud? little hostile

Little hostile as I have to defend the work I made :) (Didn't realize I had to do that, but ok)

Edited by Medusa

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.