sk8rjess 3 Posted May 20, 2016 Report Share Posted May 20, 2016 (edited) Was in the for sale sub-forum but decided to make this free since it's not very big. It's just an execution timer for up to 24 hours - and as of right now(5/23/2016) it won't show the proper time overnight. Add the start function at the beginning of your script and the end timer at the end and you'll have variables of the hours, minutes, and seconds that the bot ran. Works on all versions of UBot. Put "Start Time()" at the beginning of your script and "End Time()" at the end. The alert is just to give you a visual. define Start Time { set(#timeStart,$find regular expression($now,"(\\d+:\\d+:\\d+)"),"Global") set(#startHour,$find regular expression(#timeStart,"^(\\d+)"),"Global") set(#startMin,$find regular expression($replace(#timeStart,"{#startHour}:",""),"^(\\d+)"),"Global") set(#startSec,$replace(#timeStart,"{#startHour}:{#startMin}:",""),"Global") } define End Time { set(#timeEnd,$find regular expression($now,"(\\d+:\\d+:\\d+)"),"Global") set(#endHour,$find regular expression(#timeEnd,"^(\\d+)"),"Global") set(#endMin,$find regular expression($replace(#timeEnd,"{#endHour}:",""),"^(\\d+)"),"Global") set(#endSec,$replace(#timeEnd,"{#endHour}:{#endMin}:",""),"Global") set(#totalHour,$subtract(#endHour,#startHour),"Global") set(#totalMin,$subtract(#endMin,#startMin),"Global") if($comparison(#totalMin,"< Less than",0)) { then { set(#totalHour,$subtract(#totalHour,1),"Global") set(#totalMin,$subtract($add(#endMin,60),#startMin),"Global") } } set(#totalSec,$subtract(#endSec,#startSec),"Global") if($comparison(#totalSec,"< Less than",0)) { then { set(#totalMin,$subtract(#totalMin,1),"Global") set(#totalSec,$subtract($add(#endSec,60),#startSec),"Global") } } } Start Time() End Time() alert("Run Time: {#totalHour} hours | {#totalMin} min | {#totalSec} sec") Edited May 23, 2016 by sk8rjess Quote Link to post Share on other sites
Enigma 78 Posted June 2, 2016 Report Share Posted June 2, 2016 This doesn't work.Error: "The given key was not present in the dictionary" and has to do with: Start time > Set > $find regular expression > $now Quote Link to post Share on other sites
abbas786 78 Posted June 2, 2016 Report Share Posted June 2, 2016 This doesn't work.Error: "The given key was not present in the dictionary" and has to do with: Start time > Set > $find regular expression > $now its working fine for me ! , Tested in on Ubot v 5.7.1 define Start Time { set(#timeStart,$find regular expression($now,"(\\d+:\\d+:\\d+)"),"Global") set(#startHour,$find regular expression(#timeStart,"^(\\d+)"),"Global") set(#startMin,$find regular expression($replace(#timeStart,"{#startHour}:",""),"^(\\d+)"),"Global") set(#startSec,$replace(#timeStart,"{#startHour}:{#startMin}:",""),"Global") } define End Time { set(#timeEnd,$find regular expression($now,"(\\d+:\\d+:\\d+)"),"Global") set(#endHour,$find regular expression(#timeEnd,"^(\\d+)"),"Global") set(#endMin,$find regular expression($replace(#timeEnd,"{#endHour}:",""),"^(\\d+)"),"Global") set(#endSec,$replace(#timeEnd,"{#endHour}:{#endMin}:",""),"Global") set(#totalHour,$subtract(#endHour,#startHour),"Global") set(#totalMin,$subtract(#endMin,#startMin),"Global") if($comparison(#totalMin,"< Less than",0)) { then { set(#totalHour,$subtract(#totalHour,1),"Global") set(#totalMin,$subtract($add(#endMin,60),#startMin),"Global") } } set(#totalSec,$subtract(#endSec,#startSec),"Global") if($comparison(#totalSec,"< Less than",0)) { then { set(#totalMin,$subtract(#totalMin,1),"Global") set(#totalSec,$subtract($add(#endSec,60),#startSec),"Global") } } } Start Time() comment("your code here") loop(10) { wait(1) } End Time() alert("Run Time: {#totalHour} hours | {#totalMin} min | {#totalSec} sec") Quote Link to post Share on other sites
sk8rjess 3 Posted June 8, 2016 Author Report Share Posted June 8, 2016 (edited) This doesn't work.Error: "The given key was not present in the dictionary" and has to do with: Start time > Set > $find regular expression > $nowMaybe update your version of UBot? I'm on 5.9.17 and it's using all native functions. $now is a date function built into UBot. its working fine for me ! , Tested in on Ubot v 5.7.1 Good deal! I was going to update this to show the days and months of time running but I didn't think anyone would honestly have a bot running that long anyways so I stopped pursuing that. Edited June 8, 2016 by sk8rjess Quote Link to post Share on other sites
nicolai 4 Posted May 9, 2017 Report Share Posted May 9, 2017 I would like to run a stop watch feature showing how long the bot has been running since clicking the start button.Would the above script work for this? 1 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted May 9, 2017 Report Share Posted May 9, 2017 I would like to run a stop watch feature showing how long the bot has been running since clicking the start button. Would the above script work for this?You can use this for thathttp://network.ubotstudio.com/forum/index.php/topic/16819-free-plugin-diagnostic-functions/ Regards,Nick Quote Link to post Share on other sites
nicolai 4 Posted May 9, 2017 Report Share Posted May 9, 2017 You can use this for thathttp://network.ubotstudio.com/forum/index.php/topic/16819-free-plugin-diagnostic-functions/ Regards,Nick Looks like good plugin. I downloaded. thank you. So if I put in my script: plugin command("Diagnosticfunctions.dll", "Stop Watch Start") where I want the stop watch to start, how I make it show the elapsed time in ui stat monitor()? 1 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted May 10, 2017 Report Share Posted May 10, 2017 There is a function ui stat monitor("elapsed time:{$plugin function("Diagnosticfunctions.dll", "Stop watch elasped time")}","") I also made this with dynamic timers. So you cane call them by name and have more than one..http://network.ubotstudio.com/forum/index.php/topic/18464-tut-custom-type-text-simulator-and-dynamic-timers-with-exbrowser-and-iron-python/ Nick 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.