Wikia

CHDK Wiki

Get day seconds example

Talk0
565pages on
this wiki
Revision as of 22:07, September 24, 2008 by Pixeldoc2000 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

get_day_seconds example Edit

Users of this script snippet will probably want to remove the chatty comments :)

rem Wait until a specific time of day before continuing
rem Author Mike McCabe nickname-for-michael at-sign mcca dot be

@title Wait until
@param d Start hr
@default d 0
@param e Start min (0 to skip timer)
@default e 0

if e<>0 then gosub "snooze"

print "The time has come."

end

:snooze
print "snooze till ", d, ":", e
sleep 3000

rem Note Fingalo syntax
z = get_day_seconds

z=z/60
print "time is ", z, "mins into day"
sleep 3000
y=d*60+e
print "reqd time is ", y, "mins into day"
sleep 3000
if y<z then goto "snoozanmore"
print "normal case"
sleep 3000
y=y-z
print "snooze for ", y, "mins"
sleep 3000
sleep y*60*1000
goto "goback"
:goback
return

:snoozanmore
print "time is earlier case"
sleep 3000
rem z is now mins left in day
z=24*60-z
print z, " mins left in day"
sleep 3000
print y, " mins after that"
sleep 3000
print "sleeping ", z+y, " mins"
sleep 3000
sleep z*60*1000+y*60*100 
goto "goback"

Around Wikia's network

Random Wiki