mitsuki Posted February 7, 2021 Share Posted February 7, 2021 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 comment Share on other sites More sharing options...
FuryShark Posted February 7, 2021 Share Posted February 7, 2021 You can use configs to see which is active Quote Link to comment Share on other sites More sharing options...
Explv Posted February 7, 2021 Share Posted February 7, 2021 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 comment Share on other sites More sharing options...
Jarl Posted February 8, 2021 Share Posted February 8, 2021 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 comment Share on other sites More sharing options...
Ricky Dactyl Posted March 1, 2021 Share Posted March 1, 2021 @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 comment Share on other sites More sharing options...
PTY Botting Posted March 4, 2021 Share Posted March 4, 2021 (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 March 4, 2021 by PTY Botting Fixed bracket formatting 2 1 Quote Link to comment Share on other sites More sharing options...