Wait Until Time

 
#1

Hello,
i have a Problem with a script which at certain times something can be said the robot.
It has worked, maybe coincidence:

Code:


WaitUntilTime( 21, 45 )
$z=1
SayWait("Sven, es ist Zeit für einen Joghurt")
$z=0
ControlCommand("Leben", PauseOn)
WaitUntilTime( 22, 30 )
$z=1
SayWait("Jetzt ist Zeit ins Bett zu gehen")
$z=0
ControlCommand("Leben", PauseOn)
Sleep( 100 )
ControlCommand("Speech Recognition", PauseOn)



Now I have him so changed that he is not alone completed and added more hours and he only works the first time from 9:00, then he says nothing.

Code:


:start

WaitUntilTime( 09, 00)
$z=1
SayWait("schlaft ihr noch")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 11, 45)
$z=1
SayWait("Jetzt ist Mittagszeit")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 18, 30)
$z=1
SayWait("Liz, jetzt ist es Zeit zum Zähneputzen")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 19, 00)
$z=1
SayWait("Liz, jetzt ist es Zeit zum schlafen")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 19, 30)
$z=1
SayWait("Liz, hast Du Dir schon die Zähne geputzt?")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 20, 00)
$z=1
SayWait("Liz,es ist Schlafenszeit")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 21, 40)
$z=1
SayWait("Sven, es ist Zeit für einen Joghurt")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

WaitUntilTime( 22, 30)
$z=1
SayWait("Jetzt ist Zeit ins Bett zu gehen")
$z=0
ControlCommand("Leben", PauseOn)
Sleep(100)
ControlCommand("Speech Recognition", PauseOn)

GoTo(start)



I think it lacks any command between the times a "or" there is?

Many Thanks for your Help

#2

WaitUntilTime will wait until the time hits. In your example, the script would need to be executed before 09:00.

#3

Use this...

Code:


:loop

IF ($hour = 14 and $minute = 8)

print("Do something")

# wait for the minute to pass
sleep(59000)

ELSEIF ($hour = 18 and $minute = 30)

print("Do something else")

# wait for the minute to pass
sleep(59000)

ELSEIF ($hour = 21 and $minute = 45)

print("Do something else")

# wait for the minute to pass
sleep(59000)

ELSE

# nothing happened, so just wait a second and continue
sleep(1000)

ENDIF

goto(loop)

#4

Thank you very much, i will test tomorrow.

#5

Hello DJ, Thank you very much, this Script works fine.