Jump to content

I need help with my code


th3gos

Recommended Posts

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" );
                        }
                }
            }
        }

 

 

Link to comment
Share on other sites

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 by Theorems
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...