April 25, 20232 yr For example im running my banking method. i open bank and sleepunitl bank open. How would u handle if it misclicks the bank and then it will skip the rest of my code that should run if bank is open? I know probably a stupid question just wondering how other people handle stuff like this. i guess everything runs on a loop and is if else statements? so if it misses something it comes back to it? Edited April 25, 20232 yr by saintpaul1
April 26, 20232 yr 3 hours ago, saintpaul1 said: How would u handle if it misclicks the bank and then it will skip the rest of my code that should run if bank is open? 1 interaction per cycle of the loop, or you only add a isBankOpen check, if you're too lazy to actually plan out/redo a stable script
April 26, 20232 yr If you wrap the interactions correctly, you don't have to worry so much about this. The code loops all the time, and this is quick. If you are worried about the sleep timer being too long, then you could try this: Use custom checks with timers/bools. The two checks you have to watchout for is if the player is moving and a bank booth / bank chest / grand exchange bank booth is visible (or if they are reachable -- up to you). Just reset a timer when those conditions are met separately from your bank interaction. For the open bank ineraction, just sleep until the "open" bool = true, but don't add a long conditional sleep. Here is a rough example (Im not gonna write in the specifics) Define the isVisible variables first, then: if ((isMoving && BankBoothisVisible) || (isMoving && BankChestisVisible) || (isMoving && GrandExchangeBoothisVisible)) { timer = System.currentTimeMillis(); } For the next portion, just check for the timer and "open" bools, then do aconditional sleep until bool "open" comes back as true coupled with your open bank interaction. This sleep shouldnt be too long since you are already checking for whether the bot is moving and reseting a timer. Edited April 26, 20232 yr by FushigiBot
April 26, 20232 yr Author 6 hours ago, Gunman said: 1 interaction per cycle of the loop, or you only add a isBankOpen check, if you're too lazy to actually plan out/redo a stable script ah okay thank you! 4 hours ago, FushigiBot said: If you wrap the interactions correctly, you don't have to worry so much about this. The code loops all the time, and this is quick. If you are worried about the sleep timer being too long, then you could try this: Use custom checks with timers/bools. The two checks you have to watchout for is if the player is moving and a bank booth / bank chest / grand exchange bank booth is visible (or if they are reachable -- up to you). Just reset a timer when those conditions are met separately from your bank interaction. For the open bank ineraction, just sleep until the "open" bool = true, but don't add a long conditional sleep. Here is a rough example (Im not gonna write in the specifics) Define the isVisible variables first, then: if ((isMoving && BankBoothisVisible) || (isMoving && BankChestisVisible) || (isMoving && GrandExchangeBoothisVisible)) { timer = System.currentTimeMillis(); } For the next portion, just check for the timer and "open" bools, then do aconditional sleep until bool "open" comes back as true coupled with your open bank interaction. This sleep shouldnt be too long since you are already checking for whether the bot is moving and reseting a timer. okay that gives me some ideas, thank you very much.
April 26, 20232 yr From the OSBot API documentation You can use getBank().open() and it will find the nearest bank and open it. You then just need to sleep until the bank is open. This method will handle everything else.
May 2, 20232 yr Author On 4/26/2023 at 2:43 AM, Gunman said: 1 interaction per cycle of the loop, or you only add a isBankOpen check, if you're too lazy to actually plan out/redo a stable script Just to come back to this thread, since listening to what u said and only perfroming 1 interaction per cycle, my code is much better. Thank you.
Create an account or sign in to comment