Jump to content

issues with widgets


Recommended Posts

Posted
List<RS2Widget> clickHereToContinueList = getWidgets().getAll().stream().filter(w -> w != null && w.isVisible() && w.getMessage() != null && w.getMessage().equals("Click here to continue")).collect(Collectors.toList());
			if (clickHereToContinueList.isEmpty()) {
				log("empty");
			}

So this is what happens, when i run the script before entering the dialogue the list is empty as it should but as soon as i exit the dialogue the list isn't empty even though i'm not in dialogue anymore. I'm not storing the widget data anywhere else, this whole code is inside onLoop, can someone tell me what could cause this ? Also, i'm using osbot version 2.5.29, i can't use 2.5.27 as when i try to run it it says my osbot version is outdated. If anyone could try the above with 2.5.27 i'd greatly appreciate it.

Posted (edited)

8f5c45d30e87288ba05da3a822d76d51.gif

		List<RS2Widget> clickHereToContinueList = getWidgets().getAll().stream().filter(w -> w != null && w.isVisible() && w.getMessage() != null && w.getMessage().equals("Click here to continue")).collect(Collectors.toList());
		if (!clickHereToContinueList.isEmpty()) {
			RS2Widget clickHereToContinue = clickHereToContinueList.get(0);
			g.draw(clickHereToContinue.getBounds());
		}

Even though Click here to continue is not there it, instead it's Please wait..., it thinks it's still there. Am i doing something wrong ?

Edited by Ayylmao420
Posted
7 minutes ago, Ayylmao420 said:

the main post code was inside onloop so it should be updating every single time onloop returns, the second code i posted was inside onpaint so yeah, it should update immediately but it isn't which is strange.

Just wondering if it never actually updates. What exactly are you using this for? Possibly a workaround.

Posted (edited)
9 minutes ago, HeyImJamie said:

Just wondering if it never actually updates. What exactly are you using this for? Possibly a workaround.

						List<RS2Widget> clickHereToContinueList = getWidgets().getAll().stream().filter(w -> w != null && w.isVisible() && w.getMessage() != null && w.getMessage().equals("Click here to continue")).collect(Collectors.toList());
						if (!clickHereToContinueList.isEmpty()) {
							RS2Widget clickHereToContinue = clickHereToContinueList.get(0);
							if (clickHereToContinue.interact("Continue")) {
								sleepUntil(() -> getWidgets().getAll().stream().filter(w -> w != null && w.isVisible() && w.getMessage() != null && w.getMessage().equals("Click here to continue")).collect(Collectors.toList()).isEmpty(), random(3000, 5000));
							}
						}

I'm clicking on Click here to continue, also notice the sleepUntil condition, it should be updating every 10ms but it still sleeps the full time because it still thinks the clickHereToContinue exists.

I tried doing this:

						if (getDialogues().isPendingContinuation()) {
							if (getDialogues().clickContinue()) {
								sleepUntil(() -> !getDialogues().isPendingContinuation(), random(3000, 5000));
							}
						}

but this one too sleeps the full amount of time because it thinks it is still pending continuation.

Edited by Ayylmao420
Posted (edited)

The Gielinor Guide and all other Tutorial Island instructions widgets do not function correctly with the Dialogues API (unless we've both been attempting to use it incorrectly). You must implement your own method for continuation.

You're also unnecessarily complicating your life with the widgets API. getWidgets().getWidgetContainingText(root, "Click here to continue") should suffice for you to get the single, visible widget containing that text.

You might find Explv's open-source script helpful. https://github.com/Explv/Tutorial-Island/blob/master/src/sections/TutorialSection.java

Edited by NoxMerc
Posted (edited)
On 11/28/2018 at 8:18 AM, NoxMerc said:

The Gielinor Guide and all other Tutorial Island instructions widgets do not function correctly with the Dialogues API (unless we've both been attempting to use it incorrectly). You must implement your own method for continuation.

You're also unnecessarily complicating your life with the widgets API. getWidgets().getWidgetContainingText(root, "Click here to continue") should suffice for you to get the single, visible widget containing that text.

You might find Explv's open-source script helpful. https://github.com/Explv/Tutorial-Island/blob/master/src/sections/TutorialSection.java

thanks, i'll investigate :)

Edit://

I tried getWidgets().getWidgetContainingText() but it still gives me the same result.

Edited by Ayylmao420
Posted
15 minutes ago, NoxMerc said:

Not sure what your issue is with a lack of code. You've been given an open-source example of a working script for clicking ClickToContinue. What's the latest code you have that's not working?

His works and so is mine but my question is why does the widget for both codes return true when the message clearly doesn't equal "Click here to continue" but actually "Please wait...". I tried filtering for "Please wait..." but osbot doesn't even find a widget with message like that even though another botting client that i tried it on does.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...