saintpaul1 Posted April 25, 2023 Share Posted April 25, 2023 (edited) 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, 2023 by saintpaul1 Quote Link to comment Share on other sites More sharing options...
Gunman Posted April 26, 2023 Share Posted April 26, 2023 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 1 Quote Link to comment Share on other sites More sharing options...
FushigiBot Posted April 26, 2023 Share Posted April 26, 2023 (edited) 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, 2023 by FushigiBot Quote Link to comment Share on other sites More sharing options...
saintpaul1 Posted April 26, 2023 Author Share Posted April 26, 2023 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. Quote Link to comment Share on other sites More sharing options...
ExtraBotz Posted April 26, 2023 Share Posted April 26, 2023 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. Quote Link to comment Share on other sites More sharing options...
saintpaul1 Posted May 2, 2023 Author Share Posted May 2, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...