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.

Nooby question regarding Widget text

Featured Replies

I'm just starting to learn to work with the API and I'm at a roadblock.

I'm trying to create a script for tut island but it's throwing me an error:

package rootTutorial;

import java.awt.*;

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "shelledroot", info = "Tutorial Runner", name = "rootTutorial", version = 0.1, logo = "")
public class main extends Script {
    @Override
    public void onStart() {
        log("Tutorial Island script!");
    }
	@Override
	public int onLoop() throws InterruptedException {
		// TODO Auto-generated method stub
		if(getWidgets().getWidgetContainingText("Accept") != null) {
			getWidgets().getWidgetContainingText("Accept").interact("Accept");
		}
		return 0;
	}
	@Override
	public void onExit(){
		log("Script has finished! Go get those 7 QP you need!");
	}
    @Override
    public void onPaint(Graphics2D g) {
    	// Drawing a simple message to the screen canvas
    	g.drawString("Hello World", 400, 250);
    }
}

It completes clicking the Accept button in the widget but somehow:

if(getWidgets().getWidgetContainingText("Accept") != null)

Still returns true afterwards..
Is this some Jagex trickery or am I just plain dumb (both could be very possible).

After clicking it the loop should restart from the top and the test should be false right?

Edited by shelledroot

  • Author
24 minutes ago, HeyImJamie said:

Check if it's visible

sooo:
if(getWidgets().getWidgetContainingText("Accept") != null && getWidgets().isVisible(widgetRoot#, widgetChild#) == true) ?

Edited by shelledroot

14 minutes ago, shelledroot said:

sooo:
if(getWidgets().getWidgetContainingText("Accept") != null && getWidgets().isVisible(widgetRoot#, widgetChild#) == true) ?
if (getWidgets().getWidgetContainingText("Accept") != null && getWidgets().getWidgetContainingText("Accept").isVisible() {
	// do shit
}

 

  • Author
1 minute ago, HeyImJamie said:

if (getWidgets().getWidgetContainingText("Accept") != null && getWidgets().getWidgetContainingText("Accept").isVisible() {
	// do shit
}

 

Thanks that works. :D

New at using an API (other then REST API's), and being off java for a few years.
This should probably get me a long way. You have my thanks and a like.

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.