Asked
— Edited

I feel like a blind man wandering around in the bush at night hoping to find my way home!
So here's where I'm at with this project, I've put some comments in so you can see what I'm trying to accomplish. Any and all help will be appreciated.
:loop
#timer to power down
$x = 0
RepeatUntil($x = 30)
$x++
Sleep(1000)
EndRepeatUntil
repeatUntil(1=2)
#what to do when timer gets to 30
set(D2,OFF)
#$x = GetDigital(D2)
ControlCommand("Script Manager", ScriptStart, "power down")#do this once
sleep(5000)
WaitForChange(GetDigital(D2))
sleep(5000)
#do this when the PIR is triggered after "power down"
$motion=getDigital(D2)
IF($motion=1) #pin went high
ControlCommand("Script Manager", ScriptStart, "Power up")#do this once
endif
#do this if PIR is triggered anytime after it has powered up
$motion=getdigital(D2)
if($motion=1)
#stay powered up - need something here - what?
sleep(10000)
EndIf
# if Pir is not triggered in 30 sec start the timer again
If($x = 30)
GoTo(loop)
endif
EndRepeatUntil
Thanks
PS. I would pay money to go to a course somewhere to learn EZ-Robot scripting!
@ Rich - I got it working! I put in an If and a ElseIf and it's working! Here's what I ended up with;
Thanks again for everyone's help. Standby though, I'm working on another script, so you know I'll be calling on the community for help.