Jump to content

First time scripting. Bot standing. help?


Recommended Posts

Posted (edited)

So i need some help since my bot just stands still and i get "error in script executor" in the logger.

this is my first time scripting, so trying to learn it all. Appreciate if the help can be in my  "noob level" of understanding!

 

This is the code....


 
Edited by obrandso
Posted
5 hours ago, Gunman said:

@obrandso The script will forever be stuck in the first if statement if you don't have law runes.

Can i put in the first if statement like this..

if (!getInventory().contains("Law rune")) {
getwalking.webwalk(bankArea);
  if (!bankArea.contains(myPOS)) {
                getWalking().webWalk(bankArea);
            }

or how do i resolve this?

Posted
 if (!getInventory().contains("Law rune")) {
            if (!bankArea.contains(myPOS)) {
                getWalking().webWalk(bankArea);
            }
            
        }

!getInventory().contains("Law rune") <- if this returns true it will forever return true. Since it always returns true it will forever loop the code above^
 

Just move the banking stuff after the bank area check would probably fix this. Avoid using static sleeps when you can. Static being sleep(1000); or sleep(random (1000, 2000)); <- both are what I consider static. Another thing why is your onloop returning hopTo which is == -1? Change it to return like 500 or something.

Posted (edited)
2 hours ago, Gunman said:

 if (!getInventory().contains("Law rune")) {
            if (!bankArea.contains(myPOS)) {
                getWalking().webWalk(bankArea);
            }
            
        }

!getInventory().contains("Law rune") <- if this returns true it will forever return true. Since it always returns true it will forever loop the code above^
 

Just move the banking stuff after the bank area check would probably fix this. Avoid using static sleeps when you can. Static being sleep(1000); or sleep(random (1000, 2000)); <- both are what I consider static. Another thing why is your onloop returning hopTo which is == -1? Change it to return like 500 or something.

So conditionalsleep better than static sleep?

 

if i change it to this code only, it would read the code under it if it returns false right?

and if true, it will keep looping the statement until i get to the bankArea?

but will it work like this then?

if (!getInventory().contains("Law rune")) {
getWalking().webWalk(bankArea);
}
            if (bankArea.contains(myPOS)) {
            getBank().open();


i wrote the code at night so i was a bit flumsy. I will change the return value...

 

EDIT: nvm i fixed it! thanks!

Edited by obrandso
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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