Time of Day Sample Script
by JeremymahargHere's a sample TIMER block that can be used to make images and scripts in a game react to the player's system clock (kind of like the GBC pokémon games that had clock batteries in them):
Code:
ON TIMER -100
hour$ = LEFT$ TIME$ 2
hour = VAL hour$
minute$ = MID$ TIME$ 4 2
minute = VAL minute$
' It is morning
IF hour = 5 THEN tod = 1
IF hour = 6 THEN tod = 1
IF hour = 7 THEN tod = 1
' It is daytime
IF hour = 8 THEN tod = 2
IF hour = 9 THEN tod = 2
IF hour = 10 THEN tod = 2
' It is noon
IF hour = 11 THEN tod = 3
IF hour = 12 THEN tod = 3
IF hour = 13 THEN tod = 3
' It is afternoon
IF hour = 14 THEN tod = 4
IF hour = 15 THEN tod = 4
IF hour = 16 THEN tod = 4
' It is evening
IF hour = 17 THEN tod = 5
IF hour = 18 THEN tod = 5
IF hour = 19 THEN tod = 5
' It is night
IF hour > 19 THEN tod = 6
IF hour < 5 THEN tod = 6
END TIMER
NOTE: I wouldn't recommend using this to control stuff that interferes with the player's ability to progress through the game. (Imagine playing at night, and having to wait until real-world daytime for the shops to open)