bap 18 Share Posted February 23, 2021 Hope you guys find this useful public static boolean changeCombatStlye(int config, int childID, String style) { WidgetChild accurateWidget = Widgets.getWidget(593).getChild(childID); if (PlayerSettings.getConfig(43) != config) { log("Switching to: " + style + " | Config: " + config); if (Tabs.isOpen(Tab.COMBAT)) { Tabs.openWithFKey(Tab.COMBAT); sleep(500,800); if (accurateWidget.interact() && PlayerSettings.getConfig(43) == config && Tab.COMBAT.isOpen()) { log("Now gaining " + style + " XP"); sleep(500,800); Tabs.openWithFKey(Tab.INVENTORY); return true; } } else { Tabs.openWithFKey(Tab.COMBAT); } } return false; } If anything can be improved, let me know! Thanks Link to comment Share on other sites More sharing options...
bap 18 Author Share Posted February 23, 2021 public boolean changeCombatStlye(int config, int childID, String style) { WidgetChild accurateWidget = Widgets.getWidget(593).getChild(childID); if (PlayerSettings.getConfig(43) != config) { log("Switching to: " + style + " | Config: " + config); if (Tabs.isOpen(Tab.COMBAT)) { sleep(500,800); return accurateWidget.interact() ? Tabs.openWithFKey(Tab.INVENTORY) : Tabs.openWithFKey(Tab.COMBAT); } else { Tabs.openWithFKey(Tab.COMBAT); } } return false; } Hopefully this is better Link to comment Share on other sites More sharing options...
Hashtag 8670 Share Posted February 23, 2021 Thank you for the contribution 🙂! I'm unsure about how combat style configs & widgets depend on the weapon you're wielding, but it would be optimal to be able to call something like setCombatStyle(CombatStyle.ACCURATE); setCombatStyle(CombatStyle.RAPID); Some things I could point out are: The following if (Tabs.isOpen(Tab.COMBAT)) { // interact with widget } else { Tabs.open(Tab.COMBAT); } can be simplified to if (Tabs.open(Tab.COMBAT)) { // interact with widget } Tabs.open will return true if the tab is already open or if it was successfully opened. Your method could be built so that it returns true if the combat style was successfully changed or the style is already activated. (Similarly how in the above example Tabs.open behaves) boolean setCombatStyle(...) { if style is set { return true; } attempt to set combat style; return style is set; } In my opinion such snippet shouldn't return back to inventory tab. If you wanted to do something else on the combat tab after changing combat style, your script would go from inventory -> combat -> inventory -> combat. The method name contains a typo 😜 Link to comment Share on other sites More sharing options...
bap 18 Author Share Posted February 23, 2021 1 hour ago, Hashtag said: Thank you for the contribution 🙂! I'm unsure about how combat style configs & widgets depend on the weapon you're wielding, but it would be optimal to be able to call something like setCombatStyle(CombatStyle.ACCURATE); setCombatStyle(CombatStyle.RAPID); Some things I could point out are: The following if (Tabs.isOpen(Tab.COMBAT)) { // interact with widget } else { Tabs.open(Tab.COMBAT); } can be simplified to if (Tabs.open(Tab.COMBAT)) { // interact with widget } Tabs.open will return true if the tab is already open or if it was successfully opened. Your method could be built so that it returns true if the combat style was successfully changed or the style is already activated. (Similarly how in the above example Tabs.open behaves) boolean setCombatStyle(...) { if style is set { return true; } attempt to set combat style; return style is set; } In my opinion such snippet shouldn't return back to inventory tab. If you wanted to do something else on the combat tab after changing combat style, your script would go from inventory -> combat -> inventory -> combat. The method name contains a typo 😜 1. Ah I didn't know it also returned true if it's already open, I assumed it would still try and do it, thanks! 2. Okay thanks, I'll update it soon 3. Yeah, it was for my own use case so I kinda didn't take that into account 4. I've been up for 24 hours man, changed tho, ty! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.