Game Variables
"Game Variables", also referred to as "Registers", store both important game information
and user-managed information that should be available to scripts. There are two different types:
Game Registers - Registers built-in to the program, listed in this documentation
User Registers - Registers defined by the user by creating extra Register space
with the appropriate option in the Game Def file
There are two different ways in which these Registers are referenced by script:
Reference By ID
When the description of a Script Command explicitly asks for a Register ID as a Parameter, Game Registers may be referenced by entering
their given ID (as in "3" for Game Register 3, "act"), and User Registers may be referenced
by prefixing the ID value with a "U" (as in "U2" for User Register 2).
Reference By Value
When the description of a Script Command asks for a "Constant Value" (an explicit number value, not a variable) as a Parameter,
the value of a Register may sometimes be substituted for this value, if the description for the Script Command explicitly
states so. When this option is available, entering a Game Register ID that is prefixed by a lower-case "r" (as in "r4" for
Game Register 4, "zone") will instruct the Command to take the current value of that Game Register as the parameter. Entering
a User Register ID that is prefixed by a capital "R" (as in "R6" for User Register 6) will instruct the Command to take the
current value of that User Register as the parameter. If the value entered for the parameter is not prefixed with "r" or "R",
it will be taken as an explicit value (the value "255" will simply mean "255").
The "Game Registers" are stored as follows:
0 - Screen_Mode
The current "Screen Mode". This value is for reference only; changing it manually
will cause undesirable effects. The Func_Set_ScreenMode
Script Command can be used to change the Screen Mode, and will automatically update this variable. Possible values are:
0 - Normal mode (default)
2 - Split-Screen Mode
1 - Curr_Screen
The screen that is currently being manipulated. This value is managed by E02 as screens are being drawn, and is most
useful during Drawing Functions. It is for reference only; changing
it manually could cause undesirable effects. Possible values are:
0 - Player 1; top/single screen
1 - Player 2; bottom screen
2 - FreezeObjects
Contains Flags for freezing various gameplay elements (0 for active, 1 for frozen):
| 0 | - | Palette Rotation/Animation |
| 1 | - | Tile Animation |
| 2 | - | Reserved |
| 3 | - | All Objects |
| ... | - | Unused |
| 28 | - | Objects with Object_Flags Flag 28 set |
| 29 | - | Objects with Object_Flags Flag 29 set |
| 30 | - | Objects with Object_Flags Flag 30 set |
| 31 | - | Objects with Object_Flags Flag 31 set |
3 - act
4 - zone
These are the IDs of the current "Act" and "Zone". Changing them
manually will have no immediate effect unless one is scripted. The InLevel variable must
be set to 0 for E02 to load the given Act/Zone. This can be managed all at once by use of the Func_Set_Level Script Command
5 - lastact
6 - lastzone
7 - InLevel
This value signifies whether the game state is "level init", or "normal gameplay". Level init is the state in which
Zone and Act data are loaded, and the Act Init Function is run.
This state lasts until the Act Init Function is broken or terminated, at which point the game is automatically set to "normal gameplay" mode.
Possible values are:
0 - Level Init
1 - Normal Gameplay
To restart a level, change this value to 0. To start a different level, change "Zone"
and "Act", and then change "InLevel" to 0. This can be managed all at once by use of the Func_Set_Level Script Command
8 - Host_Platform
This value specifies which platform E02 is running on:
0 - DOS
1 - Windows
2 - x86 Linux
3 - x86 Mac
4 - PPC Mac
5 - Wii
6 - PSP
It is for reference only, changing it manually could cause undesirable effects.
9 - Curr_Player
This value is the Player (not Character) ID number of the Player that is currently
being processed. It is for reference only, changing it manually could cause undesirable effects.
Advanced - The "Current Player" can be set manually by using one of the
Func_Set_CurrPlayer_??? Script Commands if a
Script Command that manipulates the "Current Player" must be used outside of normal Player processing. If
this Command is used during normal Player processing for any reason, the original "Current Player" must
be restored after the desired operation is complete
10 - XMEffectParam
When a "Zxx" effect is encountered during the playing of an XM module, this variable is set equal to the accompanying Effect Parameter ("xx")
This is generally read within a Scripted XM Event Function to determine what event is being called, and how to process it
Manually altering this value has no effect
11 - Tiles_Length_X
12 - Tiles_Length_Y
This is the number of tiles that will fit on the screen in it's current size on
the X and Y axes. They are for reference only; changing them manually will cause undesirable
effects
13 - Screen_Active_Width
14 - Screen_Active_Height
These are the screen resolution given to objects and players when they need it, which
is not necesarily the current resolution. They are for reference only; changing
them manually will cause undesirable effects
15 - Screen_Actual_Width
16 - Screen_Actual_Height
These are the actual size of the current screen resolution. They are for reference only; changing
them manually will cause undesirable effects
17 - mainvpx
18 - mainvpy
19 - vpxr[0]
20 - vpxr[1]
21 - vpyr[0]
22 - vpyr[1]
23 - LevelBound_X1[0]
24 - LevelBound_X1[1]
25 - LevelBound_Y1[0]
26 - LevelBound_Y1[1]
27 - LevelBound_X2[0]
28 - LevelBound_X2[1]
29 - LevelBound_Y2[0]
30 - LevelBound_Y2[1]
31 - Target_LevelBound_X1[0]
32 - Target_LevelBound_X1[1]
33 - Target_LevelBound_Y1[0]
34 - Target_LevelBound_Y1[1]
35 - Target_LevelBound_X2[0]
36 - Target_LevelBound_X2[1]
37 - Target_LevelBound_Y2[0]
38 - Target_LevelBound_Y2[1]
These values are used to control the "LevelBound" values above. If the values above are not
equal to their counterparts here, they will "scroll" to those targets in steps of 2 if they must cross the
visible screen area or are at the screen's edge. Otherwise, they will instantly be set to these targets
These values may be most easily set by use of the Func_Set_Player_TargetBounds Script Command
39 - XLoop_Active[0]
40 - XLoop_Active[1]
41 - YLoop_Active[0]
42 - YLoop_Active[1]
These values control whether Level Looping on the X and/or Y axis is active for either screen.
They may be set manually in the following way:
0 - The "LevelBound" settings will cause the screen to stop scrolling when those boundaries are reached
1 - The "LevelBound" settings will cause the level section within those boundaries to loop
43 - BGOffsetX[0]
44 - BGOffsetX[1]
45 - BGOffsetY[0]
46 - BGOffsetY[1]
47 - XLoop_Size[0]
48 - XLoop_Size[1]
49 - YLoop_Size[0]
50 - YLoop_Size[1]
51 - Curr_Palette
The ID of the Level Palette that is currently being
used for display. This value is for reference only; changing it manually
will cause undesirable effects. The Func_Switch_Palette
Script Command can be used to change the Level Palette that will be used for display
52 - VPX_Bounce
53 - VPY_Bounce
When these values are set, they offset the viewport on the X or Y axis by the given pixel amount, and are automatically modified in such a way that the screen appears to "shake".
Given a setting of 4, for example, the pattern would be: 4, -4, 3, -3, 2, -2, 1, -1, 0
54 - Water_Level
55 - FrameCounter
This value automatically increases by 1 for every Game Frame that is processed. It can be read or set for any reason at any time
.... - ....
Registers 56-244 are currently unused
245 - Key_InitialDelay
This value specifies the number of Game Frames for which a key's "Repeat" state should remain false after first being pressed.
Once this delay has expired, the "Repeat" state will become true for exactly one frame before "Key_RepeatDelay" takes effect
246 - Key_RepeatDelay
This value specifies the number of Game Frames that should pass between each frame that a key's "Repeat" state becomes true.
Once a key has been pressed, and "Key_InitialDelay" expires, the "Repeat" state becomes true for exactly one frame, and then becomes false again for the number of frames specified by this value.
The "Repeat" state then becomes true again for exactly one frame before this same delay is repeated, and this process continues until the key is released
247 - VSync
This value specifies whether or not "VSync" (reduces "tearing", but can be slower) is used. Possible values are:
0 - VSync is not enabled
1 - VSync is enabled only in full-screen mode (default)
2 - VSync is enabled only in windowed mode
3 - VSync is enabled in all modes
248 - GameFlags
Contains miscellaneous Flags:
0 - FPS Display Toggle- 0 for off, 1 for on
1 - The type of song that is (or is about to be) playing- 0 for Wav, 1 for XM
249 - FrameSkipCount
When "Frame Skipping" is enabled ("FrameSkip" is nonzero), this is the counter. The counter counts up to the
value of "FrameSkip" and then resets, and the screen is only drawn each time the counter value is 0
250 - FrameSkip
This value specifies the number of Frames that will be skipped (the game will run this many Game Frames before
the screen is drawn). If this value is 0, the screen is updated for every Game Frame
251 - FrameLock
This value determines whether or not the game's frame rate will be locked to 60 Game Frames per second. Possible values are:
0 - The game will update based on a timer that only allows for a maximum of 60 Game Frames per second
1 - The game will process as many Game Frames per second as the host system can handle (this rate will be erratic, as each Game Frame will take a different amount of time to process depending on what needs to be done)
252 - piccount
This is the ID that will be assigned to the next screen-shot
253 - GamePaused
If this value is "1", the game will be in "Paused" mode. Scripts, as well as
everything else, will be stopped in this mode, so setting this value manually will freeze the game
permanently. To put the game into a controllable "Paused" mode, one of the
Func_PauseGame_??? Script Commands
may be used to assign a Game Function or Status Script Object to run during the "Pause". This will be
the only Function or Object that will be active during the "Pause", and is the only way that the "Pause"
can be disabled
If this value is greater than 1, this Register acts as a counter, and that number of Game Frames will
be processed before the game enters "Paused" state. This can be managed by a Function or Status Script Object
assigned to run during the pause
If this value is 0, the game will run normally
254 - Max_Objects_Used
This value represents the number of Game Objects that are currently active.
This value is for reference only; changing it manually will cause undesirable effects
255 - Reserved
Index:
0 - Screen_Mode
1 - Curr_Screen
2 - FreezeObjects
3 - act
4 - zone
5 - lastact
6 - lastzone
7 - InLevel
8 - Host_Platform
9 - Curr_Player
10 - XMEffectParam
11 - Tiles_Length_X
12 - Tiles_Length_Y
13 - Screen_Active_Width
14 - Screen_Active_Height
15 - Screen_Actual_Width
16 - Screen_Actual_Height
17 - mainvpx
18 - mainvpy
19 - vpxr[0]
20 - vpxr[1]
21 - vpyr[0]
22 - vpyr[1]
23 - LevelBound_X1[0]
24 - LevelBound_X1[1]
25 - LevelBound_Y1[0]
26 - LevelBound_Y1[1]
27 - LevelBound_X2[0]
28 - LevelBound_X2[1]
29 - LevelBound_Y2[0]
30 - LevelBound_Y2[1]
31 - Target_LevelBound_X1[0]
32 - Target_LevelBound_X1[1]
33 - Target_LevelBound_Y1[0]
34 - Target_LevelBound_Y1[1]
35 - Target_LevelBound_X2[0]
36 - Target_LevelBound_X2[1]
37 - Target_LevelBound_Y2[0]
38 - Target_LevelBound_Y2[1]
39 - XLoop_Active[0]
40 - XLoop_Active[1]
41 - YLoop_Active[0]
42 - YLoop_Active[1]
43 - BGOffsetX[0]
44 - BGOffsetX[1]
45 - BGOffsetY[0]
46 - BGOffsetY[1]
47 - XLoop_Size[0]
48 - XLoop_Size[1]
49 - YLoop_Size[0]
50 - YLoop_Size[1]
51 - Curr_Palette
52 - VPX_Bounce
53 - VPY_Bounce
54 - Water_Level
55 - FrameCounter
.... - ....
245 - Key_InitialDelay
246 - Key_RepeatDelay
247 - VSync
248 - GameFlags
249 - FrameSkipCount
250 - FrameSkip
251 - FrameLock
252 - piccount
253 - GamePaused
254 - Max_Objects_Used
255 - Reserved