HaHaItsJake 25 Posted January 2, 2015 Report Share Posted January 2, 2015 After a few weeks of breaking, I'm back in the game to finish this. Looking for a way to set a timer via UI, and have the script keep running until the timer is up. Example: I set the UI to keep running for straight 2 hours. After the 2 hours are up, the bot should stop. What would be the best way to go about this? Call the computer time, then add the time set from UI and check the computer time to see if it matches the time needed to stop? Regards,HaHaItsJake Quote Link to post Share on other sites
pftg4 102 Posted January 2, 2015 Report Share Posted January 2, 2015 simple way would be run wait command in a thread Quote Link to post Share on other sites
HaHaItsJake 25 Posted January 2, 2015 Author Report Share Posted January 2, 2015 simple way would be run wait command in a thread Yeah, That's what I was thinking about doing and have it set a var to "true" once the timer hit the time set in UI then have the main bot check the var. Regards,HaHaItsJake Quote Link to post Share on other sites
HaHaItsJake 25 Posted January 5, 2015 Author Report Share Posted January 5, 2015 Found: From Acamso Post: http://www.ubotstudio.com/forum/index.php?/topic/16777-get-ui-timer-source-code/ Edited to: Plugins Needed: Variablemulti.dll by Kev123 (http://www.ubotstudio.com/forum/index.php?/topic/16045-free-bulk-reset-plugin-lists-and-variables/) Waitfor Formate: 02:45:37 = 2 hours 45 minutes 37 secondsHH:MM:SS (Must have 2) 00:35:45 = 35 minutes and 45 secondsIf Timer = Waitfor then it stops. ui stat monitor("Timer: ", #timer) ui stat monitor("Status: ", #status) ui text box("Wait For", #WaitFor) plugin command("Variablemulti.dll", "Bulk Variable Set", 00, "#seconds #minutes #hours") set(#status, "Running", "Global") thread { loop while($comparison(#status, "=", "Running")) { set(#timer, $Timer(), "Global") wait(1) if($comparison(#timer, "=", #WaitFor)) { then { set(#status, "Complete", "Global") } } } } define $Timer { increment(#seconds) if($comparison(#seconds, "=", 60)) { then { set(#seconds, 0, "Global") increment(#minutes) } } if($comparison(#minutes, "=", 60)) { then { set(#minutes, 00, "Global") increment(#hours) } } if($comparison(#seconds, "<", 10)) { then { set(#seconds, "0{#seconds}", "Global") } } if($both($comparison(#minutes, ">", 0), $comparison(#minutes, "<", 10))) { then { set(#minutes, "0{#minutes}", "Global") set(#minutes, $replace(#minutes, 00, 0), "Global") } } if($both($comparison(#hours, ">", 0), $comparison(#hours, "<", 10))) { then { set(#hours, "0{#hours}", "Global") set(#hours, $replace(#hours, 00, 0), "Global") } } set(#timer, "{#hours}:{#minutes}:{#seconds}", "Global") return(#timer) } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.