#timer to power down
$x = 0
RepeatUntil($x = 30)
#what to do when timer gets to 30
#$x = GetDigital(D2)
ControlCommand("Script Manager", ScriptStart, "power down")#do this once
#do this when the PIR is triggered after "power down"
IF($motion=1) #pin went high
ControlCommand("Script Manager", ScriptStart, "Power up")#do this once
#do this if PIR is triggered anytime after it has powered up
#stay powered up - need something here - what?
# if Pir is not triggered in 30 sec start the timer again
If($x = 30)
PS. I would pay money to go to a course somewhere to learn EZ-Robot scripting!