Jump to content
UBot Underground

Ui Timer -> Stops The Script


Recommended Posts

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

Link to post
Share on other sites

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

Link to post
Share on other sites

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 seconds
HH:MM:SS 
(Must have 2) 
00:35:45 = 35 minutes and 45 seconds

If 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)
}

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...