acamso 55 Posted August 18, 2014 Report Share Posted August 18, 2014 Here's a source for a UI timer for everyone to use. The first timer is for "Advanced Ubot" owners with "comparison x2". The second timer is without. The timer is in 00:00:00 format. Hope it helps.. ui stat monitor("Timer: ", #timer) ui stat monitor("Status: ", #status) ui drop down("Wait: ", "5,10,15,30,60,90,120,150,180,210,240,3600,7200", #wait) set(#seconds, 54, "Global") set(#minutes, 59, "Global") set(#hours, 00, "Global") set(#status, "Running", "Global") thread { loop while($comparison(#status, "=", "Running")) { set(#timer, $Timer(), "Global") wait(1) } } wait(#wait) 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($plugin function("Advanced Ubot.dll", "$comparison x2", #minutes, "<", 10, "&&", #minutes, ">", 0)) { then { set(#minutes, "0{#minutes}", "Global") set(#minutes, $replace(#minutes, 00, 0), "Global") } } if($plugin function("Advanced Ubot.dll", "$comparison x2", #hours, "<", 10, "&&", #hours, ">", 0)) { then { set(#hours, "0{#hours}", "Global") set(#hours, $replace(#hours, 00, 0), "Global") } } set(#timer, "{#hours}:{#minutes}:{#seconds}", "Global") return(#timer) } define $Timer2 { 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, ">", 0))) { then { set(#minutes, "0{#minutes}", "Global") set(#minutes, $replace(#minutes, 00, 0), "Global") } } if($both($comparison(#hours, ">", 0), $comparison(#hours, ">", 0))) { then { set(#hours, "0{#hours}", "Global") set(#hours, $replace(#hours, 00, 0), "Global") } } set(#timer, "{#hours}:{#minutes}:{#seconds}", "Global") return(#timer) } 1 Quote Link to post Share on other sites
acamso 55 Posted August 18, 2014 Author Report Share Posted August 18, 2014 Oh and the timer and wait amount in the example isn't synced properly for some reason, but the function works well. It works for 5 sec and 10 sec, but losing a sec for 15 sec, and 2 sec for 30 sec. So I guess it loses a second every 15 seconds or so.. Quote Link to post Share on other sites
cob007 19 Posted August 31, 2014 Report Share Posted August 31, 2014 (edited) has there been any update to this?I wanted a timer that can be like a productivity tool to capture how long somebody has been using his computer to be used inside a bot. Edited August 31, 2014 by cob007 Quote Link to post Share on other sites
HaHaItsJake 25 Posted January 5, 2015 Report Share Posted January 5, 2015 Hey Acamso, Great work, Very useful implementing this into my script. Had to fix the Timer2 function. It was adding an extra "0" once it goes past 10 for minutes and hours. Before:($both($comparison(#VAR, ">", 0), $comparison(#VAR, ">", 0))) After:($both($comparison(#VAR, ">", 0), $comparison(#VAR, "<", 10))) define $Timer2 { 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) } I added a check to compare 2 different times to stop the script if someone looking for that method. More Info: (http://www.ubotstudio.com/forum/index.php?/topic/17427-ui-timer-stops-the-script/) Regards, HaHaItsJake Quote Link to post Share on other sites
UBotDev 276 Posted January 6, 2015 Report Share Posted January 6, 2015 Here is a much shorter and more accurate method (using my datetime manipulation plugin): ui drop down("Wait","1,2,3,4,5,10,15,20",#TIME Wait) ui stat monitor("Time",#TIME) set(#TIME Start,$plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),"Global") set(#TIME End,$add(#TIME Start,#TIME Wait),"Global") loop while($comparison($plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),"<=",#TIME End)) { set(#TIME,$subtract($plugin function("DateTime Manipulation.dll", "$datetime manipulation", $date, "UBOT", "UNIX", "en-US", "en-US"),#TIME Start),"Global") wait(0.1) } 1 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.