Zeroun_Scripts

Elapsed Time

Jun 12th, 2021 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. While 1
  2. {
  3.     ;Capture the current A_TickCount time if you don't already have it
  4.     if(currentTime = "")
  5.     {
  6.         currentTime := runTime()
  7.         ;If no maxTime is set, add current + X amount of seconds to the trigger
  8.         if(maxTime = "")
  9.         {
  10.             maxTime := currentTime + 05
  11.         }
  12.     }
  13.     ;Capture the current A_TickCount time repeatedly until maxTime is hit
  14.     elapsedTime := runTime()
  15.     MsgBox MaxTime:%maxTime% and ElapsedTime:%elapsedTime%
  16.     ;If elapsedTime is >= to your maxTime then
  17.     if(elapsedTime >= maxTime)
  18.     {
  19.         ;Add your code here
  20.         MsgBox check yo bot fool
  21.         ;Increase your maxTime by X amount of seconds to when you wanna check again
  22.         maxTime := maxTime + 5
  23.     }
  24.    
  25.    
  26. }
  27.  
  28. ; === FUNCTIONS ===
  29. runTime() {
  30.     Global
  31.     if !CounterBefore
  32.         CounterBefore := A_TickCount
  33.     Return toHHMMSS((A_TickCount - CounterBefore) / 1000)
  34. }
  35.  
  36. toHHMMSS(sec) {
  37.     oldFormat := A_FormatFloat
  38.     SetFormat, Float, 02.0
  39.     hrs := sec // 3600 / 1
  40.     min := Mod(sec // 60, 60) / 1
  41.     sec := Mod(sec, 60) / 1
  42.     SetFormat, Float, % oldFormat
  43.     Return (hrs ? hrs "" : "") (min ? min "" : "") sec ""
  44. }
  45.  
  46. F12::ExitApp
Add Comment
Please, Sign In to add comment