March 7, 20187 yr 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)); }
March 7, 20187 yr You should learn how to write a basic java program before trying to script. There are plenty of online resources that are great to learn from but if you don’t know what a return value is or how to use it you’re going to have a very hard time scripting.
March 7, 20187 yr 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.
March 7, 20187 yr do not use while loops NO bank.withdraw returns a boolean result if (bank.withdraw(...)){ //we got an item } You can see return types per method here http://osbot.org/api
March 7, 20187 yr You're already in a loop, no need to start another one. Use what @Chris said. I suggest learning more before trying to script.
March 7, 20187 yr Learn java basics, check the API and some scripts written in here, and use conditional sleep and some failsafe checks.
March 7, 20187 yr if (getBank().withdraw("CamelToe",69)) { log ("We withdrew a camel toe."); } else { log ("Camel toe was not withdrawn"); }
Create an account or sign in to comment