Jump to content

Widget not working properly


matman

Recommended Posts

I am trying to smelt at the furnace in Al-Kharid. I use the following code (roughly) to smelt:

 

 

Entity Furnace = objects.closest(24009);

Furnace.interact("Smelt");

 

RS2Widget smelter = getWidgets().getWidgetContainingText("Silver");

smelter.interact("Smelt X");

 

 

The problem is it doesn't actually click on the ''smelt X'' option. It recognises the the correct part of the widget and hovers over the silver bar but doesn't actually right click and then click on the ''smelt x'' option. I am a noob to scripting. I don't generally understand the whole Widget thing. Any help would be appreciated. Cheers!

Link to comment
Share on other sites

I am trying to smelt at the furnace in Al-Kharid. I use the following code (roughly) to smelt:

 

 

Entity Furnace = objects.closest(24009);

Furnace.interact("Smelt");

 

RS2Widget smelter = getWidgets().getWidgetContainingText("Silver");

smelter.interact("Smelt X");

 

 

The problem is it doesn't actually click on the ''smelt X'' option. It recognises the the correct part of the widget and hovers over the silver bar but doesn't actually right click and then click on the ''smelt x'' option. I am a noob to scripting. I don't generally understand the whole Widget thing. Any help would be appreciated. Cheers!

The widget you are using most likely doesn't have an associated interaction option "Smelt X" which can be verified by opening the widget debugger and looking at the widget's interaction options. However you can always right click the widget and select the given option in the menu.

mouse.click(new WidgetDestination(bot, smelter), true);
new ConditionalSleep(3000, 20, 200) {
    @Override
    public boolean condition() {
        return menu.isOpen();
    }
}.sleep();
menu.selectAction("Smelt X");
  • Like 2
Link to comment
Share on other sites

 

The widget you are using most likely doesn't have an associated interaction option "Smelt X" which can be verified by opening the widget debugger and looking at the widget's interaction options. However you can always right click the widget and select the given option in the menu.

mouse.click(new WidgetDestination(bot, smelter), true);
new ConditionalSleep(3000, 20, 200) {
    @Override
    public boolean condition() {
        return menu.isOpen();
    }
}.sleep();
menu.selectAction("Smelt X");

 

Hey thanks very much for your help. I checked the widget debugger for (root -311,child- 7) and it has null for both Actions and Options. So I guess this means the interact option won't work with this widget like you said? I tried this exact code you pasted but it only works upto the point where it right clicks on the widget. The cursor doesn't move onto the ''Smelt X'' option after right clicking. So I used another code to right click and select the ''smelt X' option like this:

 

    Entity Furnace = objects.closest(24009);

    Furnace.interact("Smelt");

    sleep(random(1000, 2000));

    RS2Widget smelter = getWidgets().getWidgetContainingText("Silver");

    smelter.interact("Smelt X");

    // *****mouse hovers over the widget at this point******

    mouse.click(true);

    sleep(1000);

    if(menu.isOpen()) {

    menu.selectAction("Smelt X");

    }

    mouse.click(false);

 

 

But here again, it stops working properly after the mouse right clicks. The cursor doesn't go to the ''Smelt X'' option after right clicking. So I guess the >>> menu.selectAction("Smelt X"); <<<part is not working. Any other way other than the 'smelter.interact("Smelt X")' and 'specifying where to right click' methods ? If i can just get this part working, the whole script will run properly. Cheerio

Link to comment
Share on other sites

Hey thanks very much for your help. I checked the widget debugger for (root -311,child- 7) and it has null for both Actions and Options. So I guess this means the interact option won't work with this widget like you said? I tried this exact code you pasted but it only works upto the point where it right clicks on the widget. The cursor doesn't move onto the ''Smelt X'' option after right clicking. So I used another code to right click and select the ''smelt X' option like this:

 

    Entity Furnace = objects.closest(24009);

    Furnace.interact("Smelt");

    sleep(random(1000, 2000));

    RS2Widget smelter = getWidgets().getWidgetContainingText("Silver");

    smelter.interact("Smelt X");

    // *****mouse hovers over the widget at this point******

    mouse.click(true);

    sleep(1000);

    if(menu.isOpen()) {

    menu.selectAction("Smelt X");

    }

    mouse.click(false);

 

 

But here again, it stops working properly after the mouse right clicks. The cursor doesn't go to the ''Smelt X'' option after right clicking. So I guess the >>> menu.selectAction("Smelt X"); <<<part is not working. Any other way other than the 'smelter.interact("Smelt X")' and 'specifying where to right click' methods ? If i can just get this part working, the whole script will run properly. Cheerio

In some menus the actions may have color tags attached. If this is the case you can run the following code to find the actual menu action strings

if (menu.isOpen()) {
	for (Option op :menu.getMenu()) {
		log(op.action);
	}
} 

It may be something like "Smelt X <col=ffffffff> Iron" 

Link to comment
Share on other sites

I am trying to smelt at the furnace in Al-Kharid. I use the following code (roughly) to smelt:

 

 

Entity Furnace = objects.closest(24009);

Furnace.interact("Smelt");

 

RS2Widget smelter = getWidgets().getWidgetContainingText("Silver");

smelter.interact("Smelt X");

 

 

The problem is it doesn't actually click on the ''smelt X'' option. It recognises the the correct part of the widget and hovers over the silver bar but doesn't actually right click and then click on the ''smelt x'' option. I am a noob to scripting. I don't generally understand the whole Widget thing. Any help would be appreciated. Cheers!

		RS2Widget silverWidget = getWidgets().getWidgetContainingText("Silver");
		
		if (silverWidget == null) {
			
		} else {
			if (silverWidget.isVisible()) {
				if (silverWidget.interact("Smelt X <col=ff9040>Silver")) {
					sleep(5000);
				}
			}
		}
Link to comment
Share on other sites

		RS2Widget silverWidget = getWidgets().getWidgetContainingText("Silver");
		
		if (silverWidget == null) {
			
		} else {
			if (silverWidget.isVisible()) {
				if (silverWidget.interact("Smelt X <col=ff9040>Silver")) {
					sleep(5000);
				}
			}
		}

Shouldn't work if as he stated before the widget doesn't have interaction actions, but the last resort always works

String action = "Smelt X";
if (menu.isOpen()) {
	Rectangle rect = null;
	List<Option> options = menu.getMenu();
	for (int i = 0; i < menu.getMenu().size(); i++) {
		if (options.get(i).action.contains(action)) {
			rect = menu.getOptionRectangle(i);
			break;
		}
	}
        if (rect != null) {
	        mouse.click(new RectangleDestination(bot, rect));
        } else {
                log("Action not found");
        }
}

Which may be required for some weird old menus that have color tags in them

Link to comment
Share on other sites

		RS2Widget silverWidget = getWidgets().getWidgetContainingText("Silver");
		
		if (silverWidget == null) {
			
		} else {
			if (silverWidget.isVisible()) {
				if (silverWidget.interact("Smelt X <col=ff9040>Silver")) {
					sleep(5000);
				}
			}
		}

 

 

In some menus the actions may have color tags attached. If this is the case you can run the following code to find the actual menu action strings

if (menu.isOpen()) {
	for (Option op :menu.getMenu()) {
		log(op.action);
	}
} 

It may be something like "Smelt X <col=ffffffff> Iron" 

Thanks both of you guys. I didn't even know those strings come with a color tag. Didn't see that coming.

So when i insert the new action string with the color tag into the >>>>smelter.interact("Smelt X <col=ff9040>Silver");   <<<<<< it works!!!!

 

But when i include the same string with the color tag into  >>>>> menu.selectAction("Smelt X <col=ff9040>Silver");  <<<<< the cursor still doesn't work after right clicking on the widget....which is strange. So I guess there is some deeper issue with 'specifying the mouse click' method ?

 

Anyway problem sorted now. Thanks a lot guys. Appreciate it.

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.
Note: Your post will require moderator approval before it will be visible.

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...