Jump to content
roguehippo

widget script upload requirments.

Recommended Posts

when submitting a script, I was told to only use root widgets for static id's, I dont know if i understand this completely. Can anyone elaborate on what this means.

here is an example of me using a widget from the script.

RS2Widget cookingWidget = getWidgets().get(270,14);
		if(cookingWidget != null)
		{
			
			String[] availableActions = cookingWidget.getInteractActions();
			for(String s: availableActions)
			{
				if(s.equals("Make"))
				{
					if(cookingWidget.interact("Make"))
					{
						probablyMakingPies = true;
						mySleep(1000);
					}
					
				}
			}
		}

 

Edited by roguehippo
Link to comment
Share on other sites

12 minutes ago, roguehippo said:

when submitting a script, I was told to only use root widgets for static id's, I dont know if i understand this completely. Can anyone elaborate on what this means.

here is an example of me using a widget from the script.

 

Widgets have 2 or 3 ids.

e.g.

123, 1

or

123, 1, 2

The root id (123) is unlikely to change, but the second and third level ids may.

So if you are going to use a fixed id at all, you should only use the root.

For example:

getWidgets().getWidgetContainingText(123, "Blah");

or

getWidgets().singleFilter(123, new Filter......

 

You should avoid using:

getWidgets().get(123, 1)

and

getWidgets().get(123, 1, 2)

Edited by Explv
Link to comment
Share on other sites

There is a widget hierarchy which you can explore with the widget debugger (in the options menu). The root id defines the highest level in this hierarchy, e.g the chatbox. Each root container will host various sub-widgets (referred to as children), and these children may have grandchildren widgets etc...

The reason for the SDN static id rule is simple: With game updates, lower level widget ids frequently change and as a result your script will break

-> A better way to filter widgets would be with text, as this is more likely to remain consistent following game updates.

Naturally, the same goes for object ids.

Hope that cleared things up,

Apa

 

Edited by Apaec
Link to comment
Share on other sites

19 minutes ago, roguehippo said:

when submitting a script, I was told to only use root widgets for static id's, I dont know if i understand this completely. Can anyone elaborate on what this means.

here is an example of me using a widget from the script.

 

Widgets contain max 3 ids:

* Root

* Child

* Subchild (? or how do you call it).

The requirement states that you can't use any lower id's than root id's.

Meaning if you want to use a widget in your script, which's id's are 351 2, you

SHOULDN'T do:

widgets.get(351, 2);

SHOULD do:

widgets.getWidgetContainingText(351, "Some text that is in the widget");

The reasoning behind this requirement, to my mind, is questionable, but still has it's points: If you hard code the id's in your script, there's a chance that the id's will change after an update and your script will break.

Though, in my mind, if Jagex changes any "child widget elements", I think they'll change the whole widget, meaning my previous example will fail as well.

If you search for widgets only using text, there's still a chance that your script will function even after changing the widget. 

Edited by nosepicker
Link to comment
Share on other sites

26 minutes ago, nosepicker said:

Though, in my mind, if Jagex changes any "child widget elements", I think they'll change the whole widget, meaning my previous example will fail as well.

Not really, for example lets say you had some screen with root widget 123

Inside were three buttons

123, 1

123, 2

123, 3

And lets say you hardcoded the widget for the third button: getWidgets().get(123, 3)

If they then inserted another button between 2 and 3, your widget would now change to 123, 4, breaking your code (you hardcoded it to 3)

The root widget 123 wouldn't change, just the child ones.

Link to comment
Share on other sites

8 hours ago, Explv said:

Not really, for example lets say you had some screen with root widget 123

Inside were three buttons

123, 1

123, 2

123, 3

And lets say you hardcoded the widget for the third button: getWidgets().get(123, 3)

If they then inserted another button between 2 and 3, your widget would now change to 123, 4, breaking your code (you hardcoded it to 3)

The root widget 123 wouldn't change, just the child ones.

I really doubt that if they added a new button, they would change previous widget id's just to make "positioning" cleaner.

Probably would end up as (just move the widgets around):

123, 1 - pos x = 1

123, 2 - pos = 2

123, 3 - pos = 4

123, 4 - pos = 3

Just thinking out loudly though.

Link to comment
Share on other sites

4 hours ago, nosepicker said:

I really doubt that if they added a new button, they would change previous widget id's just to make "positioning" cleaner.

Probably would end up as (just move the widgets around):

123, 1 - pos x = 1

123, 2 - pos = 2

123, 3 - pos = 4

123, 4 - pos = 3

Just thinking out loudly though.

I mean I'm pretty sure I've seen it in an update before, and I don't think I've seen widget IDs that haven't been in order.

But let's just agree to disagree :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...