shelledroot Posted July 6, 2017 Share Posted July 6, 2017 (edited) 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 July 6, 2017 by shelledroot Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted July 6, 2017 Share Posted July 6, 2017 Check if it's visible Quote Link to comment Share on other sites More sharing options...
TTTTurbo Posted July 6, 2017 Share Posted July 6, 2017 17 minutes ago, HeyImJamie said: Check if it's visible Quote Link to comment Share on other sites More sharing options...
shelledroot Posted July 6, 2017 Author Share Posted July 6, 2017 (edited) 24 minutes ago, HeyImJamie said: Check if it's visible sooo: if(getWidgets().getWidgetContainingText("Accept") != null && getWidgets().isVisible(widgetRoot#, widgetChild#) == true) ? Edited July 6, 2017 by shelledroot Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted July 6, 2017 Share Posted July 6, 2017 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 } 1 Quote Link to comment Share on other sites More sharing options...
shelledroot Posted July 6, 2017 Author Share Posted July 6, 2017 1 minute ago, HeyImJamie said: if (getWidgets().getWidgetContainingText("Accept") != null && getWidgets().getWidgetContainingText("Accept").isVisible() { // do shit } Thanks that works. 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. Quote Link to comment Share on other sites More sharing options...