Jump to content

How to properly use return values


Recommended Posts

Posted

Sorry if this is a stupid question, I'm new to writing bots. What's the proper way to use the return value of something like 

 

bank.withdraw(x, 1);

 

is something like this safe or is there some convention?

 

while (!bank.withdraw(x, 1)) {

     sleep(random(100, 500));

}

Posted
34 minutes ago, KevDev said:

Sorry if this is a stupid question, I'm new to writing bots. What's the proper way to use the return value of something like 

 

bank.withdraw(x, 1);

 

is something like this safe or is there some convention?

 

while (!bank.withdraw(x, 1)) {

     sleep(random(100, 500));

}

while (!inventory.contains("itemname")){

bank.withdraw(x,1);

sleep(500);

}

Will attempt to withdraw the item until the boolean is true which is when item is in your inventory.

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