Global Variables

The Main script contains the game's global variables. These are the local variables of Main.sc, but the interpreter considers them to be global. The difference between these variables, and locals of the other scripts, is that any script which "use"es Main can read/manipulate them. You can think of them as public variables. If you need a variable to be accessed by more than one script, the simpliest solution would be to put it in Main.sc's local segment.

The global variables of the template game are as follows:

Main
gEgo points to the ego's class
gGame points to the game instance
gSpeed the game speed (delay each interpreter cycle)
gQuitGame if set to TRUE, the game will exit
 
Event Handlers
gCast points to the cast class (list of actors)
gRegions points to the regions class (list of regions)
gLocales points to the locales class (list of locales)
gTimers points to the timers class (list of timers)
gSounds points to the sounds class (list of sounds)
gInv points to the inventory class
gAddToPics points to the add to pics class
gFeatures points to the add to features class
gSFeatures points to the add to sfeatures class
 
Rooms
gRoom points to the current room instance
gRoomNumberExit room number exit
gPreviousRoomNumber the number of the previous room
gRoomNumber the number of the current room
gDebugOnExit enter debug mode on room exit
 
Score
gScore the game score
gMaxScore the maximum game score
gOldScore previous score
 
Resources
gCurrentCursor the number of the current cursor
gNormalCursor the number of the normal cursor (ie. arrow)
gLoadingCursor the number of the loading cursor (ie. hand)
gDefaultFont the number of the default font
gSaveRestoreFont the number of the font for the save/restore dialogs
gDeadFont the number of the font for the dialog when ego dies
 
Time
The following three variables indicate the time elapsed since the game was started.
Format: hh:mm:ss | gTimeHours:gTimeMinutes:gTimeSeconds
gTimeSeconds the seconds
gTimeMinutes the minutes
gTimeHours the hours
gCurrentTime the current time in seconds
 
Pictures
gCheckAniWait the checkAni delay
gPicAngle the room's pic angle
gSetRegions a flag -- see User:doit()
gOverlay whether to overlay the picture when drawing
gDefaultPalette the default palette to use for the pictures (0-3)
gDefaultPicAni the default pic animation
 
Windows
gPrintDlg points to the current Print() window
gTheWindow points to the window class
gWndColor the color of the game's windows foreground (ie. text)
gWndBack the color of the game's windows background
gOldPort the previous port
 
Sound
gVolume the sound volume
gTheMusic points to the music class
gTheSoundFX points to the sound fx class
 
Misc
/* hh:mm:ss | gTimeHours:gTimeMinutes:gTimeSeconds */ /* the time elapsed since the game started */
gUserEvent points to the user's event object
gVersion the version string
gSaveDirPtr points to the save directory string
gCastMotionCue if set, the cast's motionCue() is called
gEgoView ego's current view number
gProgramControl states whether the program has control or the user