Main
Projects
Art
Music
Scripting
LiveJournal
Forum
Links
Counter Script
by Moogle1

This script is useful for when you want to have the player escape in a set amount of time. It will keep running during battles... neat!


#COUNTER
# Run "startctr" first. Then, you can use the other scripts
# to find how much time has elapsed since startctr. It can't do
# seconds, though, so it's best to reserve this for long 
# countdowns. It also can't do countdowns of more than 24 
# hours -- if your game is more than 24 hours long, then let me
# know and I'll change the script to accomodate. ^_^
include,plotscr.hsd

define script(1,startctr,none)
define script(autonumber,cmin,none) #returns minutes (from 0 to 59)
define script(autonumber,cmintotal,none) #returns minutes (total)
define script(autonumber,chr,none) #returns hours
# Note: Autonumbered scripts are used when a script need not be called from
# the game. These are meant to be called only from other scripts.

global variable (2,smin) #start minutes
global variable (3,shr) #start hours

script,startctr,begin
 set variable(smin,minutesofplay)
 set variable(shr,hoursofplay)
# simple enough, just sets the starting variables to the current playtime.
end

script,cmin,begin
 variable(rvar) #"return variable"
 setvariable(rvar,minutesofplay--smin)
 if (rvar<<0) then (set variable(rvar,rvar+60))
 return (rvar)
end

script,cmintotal,begin
 variable (rvar)
 set variable(rvar,cmin+(chr*60))
 return (rvar)
end

script,chr,begin
 variable (rvar)
 setvariable(rvar,hoursofplay--shr)
 if (minutesofplay<<smin) then (decrement(rvar))
 if (rvar<<0) then (set variable(rvar,rvar+24))
end


Site layout (c)2000 Jennifer Raby. Used by permission.