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.

Detecting level up

Featured Replies

When you level up you stop skilling, how can I detect this and restart?

Right now I'm using message detection using onMessage but It doesn't seem to work.

boolean doBreak = false;

@Override
public void onMessage(Message m){
	if(m.getType() == MessageType.GAME && m.getMessage().contains("You are now level") && !doBreak){
		doBreak = true;
	}
}

@Override
public int onLoop() throws InterruptedException {
	// code to start making pizza
	while(getInventory().contains("Anchovies") && getInventory().contains("Plain pizza")){
		sleep(random(250, 500));
		if(doBreak){
			doBreak = false;
			sleep(random(100, 200));
			break;
		}
	}
}

Full code: https://hastebin.com/defifurane.java

mm if that void works then u could just try using the getskills.getstatic.cooking? and store the previous level as an int somewhere, thats what i did for switching weapons whilst leveling up atk

private void handleDialogue() {
        if (getDialogues().isPendingContinuation()) {
            getDialogues().clickContinue();
            log("Handling dialogue");
            Sleep.sleepUntil(() -> !getDialogues().isPendingContinuation(), 5000);
        }
    }

Sleep class is from explvs conditional sleep snippet

You will need a more advanced solution for this rather than just checking for the level up message, to account for other interruptions and to more reliably accommodate for level ups.

I'm not sure how you're tracking when you finish the inventory (hopefully not a massive 40 second long sleep!), but I would suggest moving over to a timer-based system (I have this implemented in my AIO Cooker). The idea is that a timer is running in the background and is reset when you're animating (or some other check to determine whether you're cooking). If this timer exceeds a threshold, then you're probably no longer cooking and the interaction code kicks in.

For this timer to work however, you will need some kind of async thread to work in. You could use the onPaint, however onPaint should really not be used for anything more than paint stuff! You will most likely have to create your own concurrent utility class which does this for you. Since it is easy to get something wrong when doing concurrent stuff, be careful and make sure you do sufficient research otherwise you might see some behaviour you did not expect. I would suggest the best way to achieve this is to extend Thread and work from there, implementing the void run method.

Good luck! (:

Apa

you might want to change that while to a conditional sleep after you move mouse off screen, that would sleep until out of pizzas or level up message is seen
 

					new ConditionalSleep(30000) {
						@Override
						public boolean condition() {
							return !inventory.contains("Plain pizza") || widgets.isVisible(233);
						}
					}.sleep();

the 233 widget is the level up message

Edited by GPSwap

 

Look at total skill level, whenever it changes, you've leveled up. 

or you could add to your sleep condition, getWidgets().getWidgetsContainingText("Click here to continue") != null; its what i use could have typos not looking at my IDE

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.