th3gos Posted March 24, 2018 Posted March 24, 2018 I'm trying to make a script that changes the attack style by reaching a specific level of one skill so that it starts up another one.Example: I'm going up Defense at level 30 when I reach level 30 I want it to change automatically because of the attack style to climb Attack In the OSBot Logger the Message appears: [INFO] [Bot # 1] [03/23 11:29:31 PM]: Defense is 30, attempting to switch attack styles but does not change the style Here my code: Spoiler int defConfig = 0; //Not right config RS2Widget defence = getWidgets().get(548,47); //not the right widget ids, dont use this method btw, use filters if(getdefLevel () >= 25 && getConfigs().get(43) != defConfig){ log ( "Defence is 30, attempting to switch attack styles" ); if ( defence != null ) { if ( defence.isVisible () ) { if ( defence.interact ( "change" ) ) { log ( "Switched attack styles" ); } } else { if ( getTabs ().open ( Tab.ATTACK ) ) { log ( "Successfully opened attack tab" ); } } } }
su1ts Posted March 24, 2018 Posted March 24, 2018 I think you just C&P this code above. Read your other topic. 1
TrekToop11 Posted March 24, 2018 Posted March 24, 2018 Take a read of this seeing as you're copy and pasting code without knowing what it does. After reading this guide you will know how to do what you're asking us to help you with, it will be better in the long term for you to read this.
Theorems Posted March 24, 2018 Posted March 24, 2018 (edited) 1 hour ago, th3gos said: Here my code Does it at least switch tabs? If so your problem might be this line: if ( defence.interact ( "change" ) ) { There is no "change" interact option for that widget as far as I'm aware. The options are stuff like "Kick" or "Stab". Edit: I'm not fully sure as I have barely done any scripting and the docs aren't fully clear but you might be able to just use .interact(); without passing in a string to make it use the default interaction. Edited March 24, 2018 by Theorems 2
blogans Posted March 24, 2018 Posted March 24, 2018 Thats my code lol, i literally said below it that it will definitely not work... The config id isnt right, nor is the interface ids and interface interaction. Take what I said in your previous code and listen, learn java before attempting to copy and paste others code.