XaLeR Posted August 11, 2017 Share Posted August 11, 2017 (edited) So I made a script that would make gold bracelets. It was working fine on OSBot 2.4.133 but now it won't work anymore on the new update. I'm not sure why, because it's using widgets to make it and those numbers are still the same. Anyone has an idea why this would happen? this is the code (Thanks Explv Tutorials) private void make() { if (!smeltingRoom.contains(myPosition())) { getWalking().webWalk(smeltingRoom); } else if (isMakeScreenVisible() || isEnterAmountPromptVisible()) { if (makeXGold()) { Sleep.sleepUntil(this::isEnterAmountPromptVisible, 3000); } if (enterRandomAmount()) { Sleep.sleepUntil(() -> !canSmeltGoldBars() || getDialogues().isPendingContinuation(), 100_000); } } else if (useGold() & useFurnace()) { Sleep.sleepUntil(this::isMakeScreenVisible, 5000); } } private boolean canSmeltGoldBars() { return getInventory().contains("Gold bar"); } private boolean useFurnace() { return getObjects().closest("Furnace").interact("Use"); } private boolean useGold() { return getInventory().interact("Use","Gold bar"); } private boolean isMakeScreenVisible() { return getWidgets().getWidgetContainingText("What would you like to make?") != null; } private boolean makeXGold() { return getWidgets().get(446,47).interact("Make-X"); } // Using a custom filter here instead of getWidgetContainingText() because it ignores widgets with root id 162 private boolean isEnterAmountPromptVisible(){ RS2Widget amountWidget = getWidgets().singleFilter(getWidgets().getAll(), widget -> widget.getMessage().contains("Enter amount")); return amountWidget != null && amountWidget.isVisible(); } private boolean enterRandomAmount() { return getKeyboard().typeString("" + MethodProvider.random(28, 35)); } Edited August 11, 2017 by XaLeR Quote Link to comment Share on other sites More sharing options...
bugsinmycode Posted August 11, 2017 Share Posted August 11, 2017 Whats actually breaking? Quote Link to comment Share on other sites More sharing options...
Solution Posted August 11, 2017 Share Posted August 11, 2017 Yeah some more information as to what is breaking would be helpful. Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 1 minute ago, bugsinmycode said: Whats actually breaking? Just now, Solution said: Yeah some more information as to what is breaking would be helpful. The moment the widget opens to make the gold bracelet, it won't interact with the bracelet to Make-X. Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 11, 2017 Share Posted August 11, 2017 3 minutes ago, XaLeR said: The moment the widget opens to make the gold bracelet, it won't interact with the bracelet to Make-X. Maybe the script is using child/grandchild ids and perhaps these changed with Jagex working on Make-All? Just speculation, without any code i cannot help. You'll have to contact the scripter via the script thread! Apa 1 Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 1 minute ago, Apaec said: Maybe the script is using child/grandchild ids and perhaps these changed with Jagex working on Make-All? Just speculation, without any code i cannot help. You'll have to contact the scripter via the script thread! Apa edited the main post with code Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 11, 2017 Share Posted August 11, 2017 (edited) 58 minutes ago, XaLeR said: edited the main post with code Perhaps it's this line? getWidgets().get(446,47).interact("Make-X"); Maybe the id has changed. You can check this in-game and update it, but better would be to future-proof it by using the Widget debugger to try and find a trait of this widget to identify it other than its id. There must be something to identify it from others - perhaps sprite? (This is the reason that static ids beyond root level are not permitted on the SDN! - ids tend to change frequently, whereas text, colour or other properties are more consistent) Edit: This method can also be adjusted: private boolean isEnterAmountPromptVisible(){ RS2Widget amountWidget = getWidgets().singleFilter(getWidgets().getAll(), widget -> widget.getMessage().contains("Enter amount")); return amountWidget != null && amountWidget.isVisible(); } ... to: private boolean isEnterAmountPromptVisible(){ return getWidgets().getWidgetContainingText(162, "Enter amount:") != null; } Apa Edited August 11, 2017 by Apaec Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 (edited) 33 minutes ago, Apaec said: Perhaps it's this line? getWidgets().get(446,47).interact("Make-X"); Maybe the id has changed. You can check this in-game and update it, but better would be to future-proof it by using the Widget debugger to try and find a trait of this widget to identify it other than its id. There must be something to identify it from others - perhaps sprite? (This is the reason that static ids beyond root level are not permitted on the SDN! - ids tend to change frequently, whereas text, colour or other properties are more consistent) Edit: This method can also be adjusted: private boolean isEnterAmountPromptVisible(){ RS2Widget amountWidget = getWidgets().singleFilter(getWidgets().getAll(), widget -> widget.getMessage().contains("Enter amount")); return amountWidget != null && amountWidget.isVisible(); } ... to: private boolean isEnterAmountPromptVisible(){ return getWidgets().getWidgetContainingText(162, "Enter amount:") != null; } Apa Thanks already for the help. I took some screenshots of the widget debugger and 446,47 still is the gold bracelet. And Sprites are -1 so i guess that will not work? Is it possible with itemID? Edited August 11, 2017 by XaLeR Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 11, 2017 Share Posted August 11, 2017 (edited) 38 minutes ago, XaLeR said: Thanks already for the help. I took some screenshots of the widget debugger and 446,47 still is the gold bracelet. And Sprites are -1 so i guess that will not work? Is it possible with itemID? If those still are the gold bracelet ids then i'm not sure what to suggest Try using log statements to pinpoint exactly which line isn't working. Also, maybe position is the best way to determine this widget from its horizontal counterparts? Using position would mean adding other bracelets in future would be simple and can be achieved with an enum or something to that effect. Edited August 11, 2017 by Apaec 1 Quote Link to comment Share on other sites More sharing options...
d0zza Posted August 11, 2017 Share Posted August 11, 2017 The interact string might have changed? Does it hover the right widget or move the mouse to it at all? Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 32 minutes ago, Apaec said: If those still are the gold bracelet ids then i'm not sure what to suggest Try using log statements to pinpoint exactly which line isn't working. Also, maybe position is the best way to determine this widget from its horizontal counterparts? Just want to say I found out with the logger that the webwalking was giving errors. Adjusted my webwalking area and it's all working again. Could you give me an example of how I could use position instead of using root and child. I'm just starting and I can't seem to find an example online. Thanks for everything! Quote Link to comment Share on other sites More sharing options...
Explv Posted August 11, 2017 Share Posted August 11, 2017 (edited) 1 hour ago, XaLeR said: Is it possible with itemID? 50 minutes ago, Apaec said: Also, maybe position is the best way to determine this widget from its horizontal counterparts? Using position would mean adding other bracelets in future would be simple and can be achieved with an enum or something to that effect. @XaLeR Looks like maybe you could make use of the spell name field of the widget? RS2Widget goldBraceletWidget = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getSpellName().contains("Gold bracelet")); Edited August 11, 2017 by Explv Quote Link to comment Share on other sites More sharing options...
Apaec Posted August 11, 2017 Share Posted August 11, 2017 8 minutes ago, XaLeR said: Just want to say I found out with the logger that the webwalking was giving errors. Adjusted my webwalking area and it's all working again. Could you give me an example of how I could use position instead of using root and child. I'm just starting and I can't seem to find an example online. Thanks for everything! Sure, grab the widget with something like this: Point widgetCoord = new Point(X,Y); getWidgets().singleFilter(ROOT_ID, widget -> new Point(widget.getAbsX(), widget.getAbsY()).equals(widgetCoord)); You can store that point in an enum if you were to support different bracelets. Also, you will have to fill in the root id Haven't tested that code as I wrote it in the reply box, but it should work. Glad the issue was solved! 3 minutes ago, Explv said: @XaLeR Looks like maybe you could make use of the spell name field of the widget? RS2Widget goldBraceletWidget = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getSpellName().contains("Gold bracelet")); Oo, I didn't spot that! looks promising. Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 4 minutes ago, Explv said: @XaLeR Looks like maybe you could make use of the spell name field of the widget? RS2Widget goldBraceletWidget = getWidgets().singleFilter(getWidgets().getAll(), w -> w.getSpellName().contains("Gold bracelet")); Yea I was trying that before I made this post. Probably it worked but the webwalking was broken so I thought to myself this doesn't work either It was stupid of me to not know there was a logger. I would've found the problem instantly. Quote Link to comment Share on other sites More sharing options...
XaLeR Posted August 11, 2017 Author Share Posted August 11, 2017 7 minutes ago, Apaec said: Sure, grab the widget with something like this: Point widgetCoord = new Point(X,Y); getWidgets().singleFilter(ROOT_ID, widget -> new Point(widget.getAbsX(), widget.getAbsY()).equals(widgetCoord)); You can store that point in an enum if you were to support different bracelets. Also, you will have to fill in the root id Haven't tested that code as I wrote it in the reply box, but it should work. Glad the issue was solved! Oo, I didn't spot that! looks promising. That seems easy enough. I'm gonna test it out. Again thanks for everything! 1 Quote Link to comment Share on other sites More sharing options...