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.

Problem with my script..

Featured Replies

I'm trying to make my own script I have got some kind of a problem i don't really know how to solve...



if (!LEVERAREA.contains(myPlayer())){
localWalker.walkPath(TOLEVER);
if (LEVERAREA.contains(myPlayer())){
lever.interact("Pull");
if (dialogues.isPendingContinuation()){
dialogues.clickContinue();
if (dialogues.isPendingOption()){
dialogues.selectOption("Yes I'm brave.");
if (players.myPlayer().isAnimating()){
sleep(random(1000,1500));
}
}
}

}

So it does walk to the LEVERAREA and when i manually leave it, it walks back.


But when it is AT the LEVERAREA it does not pull the lever...


you have your code setup in a bad way with all the nests. Move the area contains check outside the not area contains check, lever.interact() returns a boolean for a reason, and need some conditional sleeps for the dialogue stuff probably.

 

I'm trying to make my own script I have got some kind of a problem i don't really know how to solve...

            if (!LEVERAREA.contains(myPlayer())){
                localWalker.walkPath(TOLEVER);
                if (LEVERAREA.contains(myPlayer())){
                    lever.interact("Pull");
                    if (dialogues.isPendingContinuation()){
                        dialogues.clickContinue();
                        if (dialogues.isPendingOption()){
                            dialogues.selectOption("Yes I'm brave.");
                            if (players.myPlayer().isAnimating()){
                                sleep(random(1000,1500));
                            }
                        }
                    }
                    
                }
            } 

So it does walk to the LEVERAREA and when i manually leave it, it walks back.

But when it is AT the LEVERAREA it does not pull the lever...

 

 

if (!LEVERAREA.contains(myPlayer()))

     localWalker.walkPath(TOLEVER);

if (LEVERAREA.contains(myPlayer()))

     lever.interact("Pull");

if (dialogues.isPendingContinuation())

     dialogues.clickContinue();

if (dialogues.isPendingOption())

     dialogues.selectOption("Yes I'm brave.");

if (players.myPlayer().isAnimating())

     sleep(random(1000,1500));

 

I could be wrong, but these are all nested if statements. Try spreading them out how I have it and see if that works.

  • Author

you have your code setup in a bad way with all the nests. Move the area contains check outside the not area contains check, lever.interact() returns a boolean for a reason, and need some conditional sleeps for the dialogue stuff probably.

Could you add me on skype?

 

My Skype name is: massih--

I'm trying to make my own script I have got some kind of a problem i don't really know how to solve...

if (!LEVERAREA.contains(myPlayer())){                localWalker.walkPath(TOLEVER);                if (LEVERAREA.contains(myPlayer())){                    lever.interact("Pull");                    if (dialogues.isPendingContinuation()){                        dialogues.clickContinue();                        if (dialogues.isPendingOption()){                            dialogues.selectOption("Yes I'm brave.");                            if (players.myPlayer().isAnimating()){                                sleep(random(1000,1500));                            }                        }                    }                                    }            }

So it does walk to the LEVERAREA and when i manually leave it, it walks back.

But when it is AT the LEVERAREA it does not pull the lever...

I would not use nested IF statements like this as this causing you logical problems.

Currently you're saying:

If not in lever area, walk to lever area. But this will not execute the second if statement because you are now in fact in the lever area so the the first boolean returns false meaning no code is executed.

Try:

if (!LEVERAREA.contains(myPlayer())){

localWalker.walkPath(TOLEVER);

} else if (LEVERAREA.contains(myPlayer())){

lever.interact("Pull");

}

You might want to famaliarise yourself with if statements and if then else statements :)

(Only changed part of the code because I am on my phone and so you can learn too)

Precise

I would not use nested IF statements like this as this causing you logical problems.

Currently you're saying:

If not in lever area, walk to lever area. But this will not execute the second if statement because you are now in fact in the lever area so the the first boolean returns false meaning no code is executed.

Try:

if (!LEVERAREA.contains(myPlayer())){

localWalker.walkPath(TOLEVER);

} else if (LEVERAREA.contains(myPlayer())){

lever.interact("Pull");

}

You might want to famaliarise yourself with if statements and if then else statements :)

(Only changed part of the code because I am on my phone and so you can learn too)

Precise

To dsd into this I'd reccomend reading http://osbot.org/forum/topic/58775-a-beginners-guide-to-writing-osbot-scripts-where-to-get-started-by-apaec/. Definatly will give you a big helping hand. I'd get used to the format that script uses using states. Will make things a lot easier/cleaner to read.

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.