mitsuki 12 Posted February 7 Share Posted February 7 So I want to essentially make a check for whether the player is training attack, strength, or defence, so that my script can activate with widgets to change the attack style. I've tried to check whether the style is visible or not, but that always returns true if the combat options screen is showing, and false if not, so it doesn't actually check if "Lunge" is selected or not. I looked into configs in the api, but can't find anything. Any Ideas? Cheers guys Quote Link to post Share on other sites
FuryShark 783 Posted February 7 Share Posted February 7 You can use configs to see which is active Quote Link to post Share on other sites
Explv 2135 Posted February 7 Share Posted February 7 15 minutes ago, mitsuki said: So I want to essentially make a check for whether the player is training attack, strength, or defence, so that my script can activate with widgets to change the attack style. I've tried to check whether the style is visible or not, but that always returns true if the combat options screen is showing, and false if not, so it doesn't actually check if "Lunge" is selected or not. I looked into configs in the api, but can't find anything. Any Ideas? Cheers guys Read section 13 of this tutorial to learn about configs Funnily enough, it actually covers attack style as the example. Screenshots are a bit out of date and the OSBot UI has changed, but there is still a config debug view in the settings. TLDR: Config 43. Quote Link to post Share on other sites
Jarl 15 Posted February 8 Share Posted February 8 Just to add on, you should pay attention to weapons with different styles/xp types. Eg. abyssal whip You would think an attack style like "slash" would always give you the same xp, bur that's not the case. Also, configs can help you check what spell you are autocasting. (You would need widgets to select spells though) Quote Link to post Share on other sites
Ricky Dactyl 4 Posted Monday at 06:29 PM Share Posted Monday at 06:29 PM @mitsuki~ not sure if you had this solved yet but I only just realised this section was a thing, here's what I've been using for my bots fresh from tutorial island. public void setAttackStyle(String trainType) { int style = script.getConfigs().get(43); switch (trainType) { case "DEFENCE": if (style != 3) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO DEFENCE"); script.widgets.get(593, 17, 4).interact(new String[0]); } break; case "ATTACK": if (style != 0) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO ATTACK"); script.widgets.get(593, 5, 4).interact(new String[0]); } break; case "STRENGTH": if (style != 1) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO STRENGTH"); script.widgets.get(593, 9, 4).interact(new String[0]); } break; } } Quote Link to post Share on other sites
PTY Botting 1 Posted Thursday at 06:52 AM Share Posted Thursday at 06:52 AM (edited) On 3/2/2021 at 7:29 AM, Ricky Dactyl said: @mitsuki~ not sure if you had this solved yet but I only just realised this section was a thing, here's what I've been using for my bots fresh from tutorial island. public void setAttackStyle(String trainType) { int style = script.getConfigs().get(43); switch (trainType) { case "DEFENCE": if (style != 3) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO DEFENCE"); script.widgets.get(593, 17, 4).interact(new String[0]); } break; case "ATTACK": if (style != 0) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO ATTACK"); script.widgets.get(593, 5, 4).interact(new String[0]); } break; case "STRENGTH": if (style != 1) { while (!script.tabs.isOpen(Tab.ATTACK)) script.getTabs().open(Tab.ATTACK); // postStatus("CHANGING ATTACK STANCE TO STRENGTH"); script.widgets.get(593, 9, 4).interact(new String[0]); } break; } } You could simplify it to something like this (Although didn't test it), another step would be changing the traintype to an enum but yeah. public void setAttackStyle(String trainType) { int style = script.getConfigs().get(43); switch (trainType) { case "DEFENCE": if (style != 3) { selectAttackStyle(17, 4); } break; case "ATTACK": if (style != 0) { selectAttackStyle(5, 4); } break; case "STRENGTH": if (style != 1) { selectAttackStyle(9, 4); } break; } } private void selectAttackStyle(int childId, int subChildId) { if (!script.getTabs().open(Tab.ATTACK)) { return; } RS2Widget widget = script.widgets.get(593, childId, subChildId); if (widget != null && widget.isVisible()) { widget.interact(); } } Edited Thursday at 06:53 AM by PTY Botting Fixed bracket formatting 1 Quote Link to post Share on other sites