How can my script wait 2 hours from the start of the script before repeating

Alphatop

Member
Hello, I have been unsuccessful in modifying a script I use to wait 2 hours from the start of the script before it attempts to repeat. Can one of you help me? I can change the script around to accommodate it if needed.

The script will log through various toons, and when finished wait until 2 hours has passed before attempting to log through those toons again.

Code:
variable int X=0
variable int TotalX=2

function main(int TempNum=9){
echo ${Time} 
     while 1 ;Start main loop that will repeat logging through toons
     {
	  X:Set[0]
;--Need to calculate what time it will be in 2 hours.
          while ${X:Inc} <= ${TotalX} ;Log through toons to accomplish something
          {
		echo Stuff that takes time
		wait 600
          }
;--Need a way to hold here until the 2 hours has passed.
     }

}
I was thinking the start of the loop could somehow calculate what time it would be in 2 hours. The second could possibly be another loop that does nothing until time is past the previously calculated 2 hours.
 

Alphatop

Member
Found a solution in one of Kannkor's scripts:

Code:
variable uint DefaultTimeToWait=7500 ;note, this is in seconds
variable uint TimeToWaitUntil=0
variable uint TimeFirstHirelingSent=0

then to initialize:
TimeFirstHirelingSent:Set[${Time.Timestamp}]
TimeToWaitUntil:Set[${TimeFirstHirelingSent}+${DefaultTimeToWait}]

and the following compare statement will solve the problem
while ( ${Time.Timestamp} < ${TimeToWaitUntil} )
      waitframe
Is there a list of what is available? Like how would I know Time.Timestamp was a variable unless I found it in another script? Is there any script writer that has intuitive variables?
 
Top Bottom