Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

I need help with my code

Featured Replies

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

 

 

I think you just C&P this code above. Read your other topic.

 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.

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

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.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.