Jump to content
UBot Underground

Recommended Posts

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. 

 

post-27896-0-72761400-1463355604.png

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 by sk8rjess
Link to post
Share on other sites
  • 2 weeks later...

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

Link to post
Share on other sites

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")

Link to post
Share on other sites

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

Maybe 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 by sk8rjess
Link to post
Share on other sites
  • 11 months later...

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?

  • Like 1
Link to post
Share on other sites

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 that

http://network.ubotstudio.com/forum/index.php/topic/16819-free-plugin-diagnostic-functions/

 

Regards,

Nick

Link to post
Share on other sites

 

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()?

  • Like 1
Link to post
Share on other sites

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

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...