Jump to content

First time scripting. Bot standing. help?


obrandso

Recommended Posts

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?

Link to comment
Share on other sites

 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.

Link to comment
Share on other sites

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
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...