Difference between revisions of "Script Classes for Adventure Games/Global Variables"
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Chapter: | Chapter: | ||
[[Script Classes for Adventure Games/Introduction|1]] | | [[Script Classes for Adventure Games/Introduction|1]] | | ||
− | [[Script Classes for Adventure Games/RootObj|2]] | | + | [[Script Classes for Adventure Games/RootObj Class|2]] | |
− | [[Script Classes for Adventure Games/Object|3]] | | + | [[Script Classes for Adventure Games/Object Class|3]] | |
− | [[Script Classes for Adventure Games/Collection|4]] | | + | [[Script Classes for Adventure Games/Collection Class|4]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Script Class|5]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Timer Class|6]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Feature Class|7]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/View Class|8]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/PicView Class|9]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Cycling Classes|10]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Motion Classes|11]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Avoider Class|12]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Event Class|13]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/User Class|14]]<br /> |
− | + | [[Script Classes for Adventure Games/Game Class|15]] | | |
− | + | [[Script Classes for Adventure Games/Locale Class|16]] | | |
− | + | [[Script Classes for Adventure Games/Region Class|17]] | | |
− | + | [[Script Classes for Adventure Games/Room Class|18]] | | |
− | + | [[Script Classes for Adventure Games/Timer2 Class|19]] | | |
− | + | [[Script Classes for Adventure Games/InvItem Class|20]] | | |
− | + | [[Script Classes for Adventure Games/Block Class|21]] | | |
− | + | [[Script Classes for Adventure Games/Cage Class|22]] | | |
− | + | [[Script Classes for Adventure Games/Sound Class|23]] | | |
− | + | [[Script Classes for Adventure Games/StatusLine Class|24]] | | |
− | + | [[Script Classes for Adventure Games/File Class|25]] | | |
− | + | [[Script Classes for Adventure Games/Code Class|26]] | | |
− | + | [[Script Classes for Adventure Games/Global Variables|27]] | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | [[Script Classes for Adventure Games/Game| | ||
− | [[Script Classes for Adventure Games/Locale| | ||
− | [[Script Classes for Adventure Games/Region| | ||
− | [[Script Classes for Adventure Games/Room| | ||
− | [[Script Classes for Adventure Games/Timer2| | ||
− | |||
− | [[Script Classes for Adventure Games/InvItem| | ||
− | [[Script Classes for Adventure Games/Block| | ||
− | [[Script Classes for Adventure Games/Cage| | ||
− | [[Script Classes for Adventure Games/Sound| | ||
− | [[Script Classes for Adventure Games/StatusLine| | ||
− | [[Script Classes for Adventure Games/File| | ||
− | [[Script Classes for Adventure Games/Code| | ||
− | [[Script Classes for Adventure Games/Global Variables| | ||
[[Script Classes for Adventure Games/Index|Index]] | [[Script Classes for Adventure Games/Index|Index]] | ||
</div><br /> | </div><br /> | ||
Line 62: | Line 39: | ||
| | ||
− | + | ==<br /> Global Variables == | |
+ | |||
+ | Global variables 0 through 49 are reserved for use by the system classes. Game-specific global variables start at 50. The following global variables are defined by the system. For up to date global list see s:system.sh. | ||
+ | |||
+ | === ego === | ||
+ | <blockquote>The ID of a static instance of class Ego defined in game.sc. This is the protagonist of the game.</blockquote> | ||
+ | |||
+ | === curRoom === | ||
+ | <blockquote>The ID of the current Room.</blockquote> | ||
+ | |||
+ | === userFont === | ||
+ | <blockquote>The number of the font to be used in Print statements, etc. Default is 1. Set it to the font you wish to use in the init: method of your Game, or change it at will in the game.</blockquote> | ||
+ | |||
+ | === cast === | ||
+ | <blockquote>The ID of a Set of Actors and Egos which constitutes the characters on the screen.</blockquote> | ||
+ | |||
+ | === quit === | ||
+ | <blockquote>The main loop of the game is | ||
+ | |||
+ | <blockquote><div class="CodeBlockHeader">Code:</div> | ||
+ | <syntaxhighlight lang="sci"> | ||
+ | (while (not quit) | ||
+ | (theGame doit:) | ||
+ | (Wait speed) | ||
+ | ) | ||
+ | </syntaxhighlight></blockquote> | ||
+ | |||
+ | so setting quit to TRUE breaks out of the main loop and terminates the game.</blockquote> | ||
+ | |||
+ | === addToPics === | ||
+ | <blockquote>A Set of PicViews which have been added to the current picture.</blockquote> | ||
+ | |||
+ | === debugOn === | ||
+ | <blockquote>A generic debugging flag. I usually have a Debug menu item to set it, and trigger any debug display that I want off of it, rather than creating a special trigger whenever I want to debug something.</blockquote> | ||
+ | |||
+ | === sounds === | ||
+ | <blockquote>The Set of Sounds currently playing.</blockquote> | ||
+ | |||
+ | === inventory === | ||
+ | <blockquote>The ID of the Inventory class or instance which is the Set of all InvItems (inventory items) in the Game. Inventory related issues are not well defined yet...</blockquote> | ||
+ | |||
+ | === theGame === | ||
+ | <blockquote>The ID of the Game instance.</blockquote> | ||
+ | |||
+ | === regions === | ||
+ | <blockquote>The Set of Regions currently in effect.</blockquote> | ||
+ | |||
+ | === curRoomNum === | ||
+ | <blockquote>The number of the current Room.</blockquote> | ||
+ | |||
+ | === prevRoomNum === | ||
+ | <blockquote>The number of the previous Room. (So you know how you got where you are.)</blockquote> | ||
+ | |||
+ | === newRoomNum === | ||
+ | <blockquote>Used by a Room to signal to the Game that it should change to a new Room.</blockquote> | ||
+ | |||
+ | === showStyle === | ||
+ | <blockquote>The global style for the transition from one picture to another. This may be overridden by the style property of a given room. See the DrawPic kernel function for the possible styles.</blockquote> | ||
+ | |||
+ | === aniInterval === | ||
+ | <blockquote>The number of ticks it took to do the last animation cycle. This is used to test animation speed on a particular machine.</blockquote> | ||
+ | |||
+ | === speed === | ||
+ | <blockquote>The number of ticks between animations. This is set, usually as a menu option, to determine the speed of animation. The default is 6.</blockquote> | ||
+ | |||
+ | === timers === | ||
+ | <blockquote>The List of timers in the game.</blockquote> | ||
+ | |||
+ | === score === | ||
+ | <blockquote>The player's current score.</blockquote> | ||
+ | |||
+ | === possibleScore === | ||
+ | <blockquote>The games highest possible score.</blockquote> | ||
+ | |||
+ | === theCursor === | ||
+ | <blockquote>The number of the current cursor.</blockquote> | ||
+ | |||
+ | === normalCursor === | ||
+ | <blockquote>Number of normal cursor form.</blockquote> | ||
+ | |||
+ | === waitCursor === | ||
+ | <blockquote>Cursor number of "wait" cursor.</blockquote> | ||
+ | |||
+ | === smallFont === | ||
+ | <blockquote>Small font for save/restore, etc.</blockquote> | ||
+ | |||
+ | === lastEvent === | ||
+ | <blockquote>The last event (used by save/restore game).</blockquote> | ||
+ | |||
+ | === modelessDialog === | ||
+ | <blockquote>The modeless Dialog known to User and Intrface.</blockquote> | ||
+ | |||
+ | === bigFont === | ||
+ | <blockquote>The number for a large font.</blockquote> | ||
+ | |||
+ | === volume === | ||
+ | <blockquote>Sound volume on supported machine.</blockquote> | ||
+ | |||
+ | === version === | ||
+ | <blockquote>The SCI version string.</blockquote> | ||
+ | |||
+ | === locales === | ||
+ | <blockquote>Set of current locales.</blockquote> | ||
+ | |||
+ | === curSaveDir === | ||
+ | <blockquote>Address of current save drive/directory string.</blockquote> | ||
+ | |||
+ | === aniThreshold === | ||
+ | <blockquote></blockquote> | ||
+ | |||
+ | === perspective === | ||
+ | <blockquote>The Player's viewing angle. This is set according to the Rooms picAngle property. Degrees away from vertical along y axis.</blockquote> | ||
+ | |||
+ | === features === | ||
+ | <blockquote>Locations that may respond to events.</blockquote> | ||
+ | |||
+ | === sortedFeatures === | ||
+ | <blockquote>The features and cast sorted by "visibility" to ego.</blockquote> | ||
+ | |||
+ | === useSortedFeatures === | ||
+ | <blockquote>If TRUE enable cast & feature sorting.</blockquote> | ||
+ | |||
+ | === egoBlindSpot === | ||
+ | <blockquote>Used by sortCopy for sortedFeatures to exclude actors behind ego within angle from straight behind. Default zero is no blind spot.</blockquote> | ||
+ | |||
+ | === overlays === | ||
+ | <blockquote>The overlay List.</blockquote> | ||
+ | |||
+ | === doMotionCue === | ||
+ | <blockquote>A motion cue has occured - process it. The Games doit method gives the motionCue: message to each element of the cast if this is set to TRUE.</blockquote> | ||
+ | |||
+ | === systemWindow === | ||
+ | <blockquote>ID of standard system window. If you wish to supply your own window for system messages set this to the ID of your window.</blockquote> | ||
+ | |||
+ | === lastSysGlobal === | ||
+ | <blockquote>Defines the end of Global variable space.</blockquote> | ||
| | ||
Line 75: | Line 187: | ||
| | ||
− | <span style="float: left">[[Script Classes for Adventure Games/ | + | <span style="float: left">[[Script Classes for Adventure Games/Code Class|< Previous: The Code Class]]</span> |
<span style="float: right">[[Script Classes for Adventure Games/Index|Next: Index >]]</span> | <span style="float: right">[[Script Classes for Adventure Games/Index|Next: Index >]]</span> | ||
Latest revision as of 02:21, 11 December 2015
Chapter:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Index
Global Variables
Global variables 0 through 49 are reserved for use by the system classes. Game-specific global variables start at 50. The following global variables are defined by the system. For up to date global list see s:system.sh.
ego
The ID of a static instance of class Ego defined in game.sc. This is the protagonist of the game.
curRoom
The ID of the current Room.
userFont
The number of the font to be used in Print statements, etc. Default is 1. Set it to the font you wish to use in the init: method of your Game, or change it at will in the game.
cast
The ID of a Set of Actors and Egos which constitutes the characters on the screen.
quit
The main loop of the game is
Code:(while (not quit) (theGame doit:) (Wait speed) )so setting quit to TRUE breaks out of the main loop and terminates the game.
addToPics
A Set of PicViews which have been added to the current picture.
debugOn
A generic debugging flag. I usually have a Debug menu item to set it, and trigger any debug display that I want off of it, rather than creating a special trigger whenever I want to debug something.
sounds
The Set of Sounds currently playing.
inventory
The ID of the Inventory class or instance which is the Set of all InvItems (inventory items) in the Game. Inventory related issues are not well defined yet...
theGame
The ID of the Game instance.
regions
The Set of Regions currently in effect.
curRoomNum
The number of the current Room.
prevRoomNum
The number of the previous Room. (So you know how you got where you are.)
newRoomNum
Used by a Room to signal to the Game that it should change to a new Room.
showStyle
The global style for the transition from one picture to another. This may be overridden by the style property of a given room. See the DrawPic kernel function for the possible styles.
aniInterval
The number of ticks it took to do the last animation cycle. This is used to test animation speed on a particular machine.
speed
The number of ticks between animations. This is set, usually as a menu option, to determine the speed of animation. The default is 6.
timers
The List of timers in the game.
score
The player's current score.
possibleScore
The games highest possible score.
theCursor
The number of the current cursor.
normalCursor
Number of normal cursor form.
waitCursor
Cursor number of "wait" cursor.
smallFont
Small font for save/restore, etc.
lastEvent
The last event (used by save/restore game).
modelessDialog
The modeless Dialog known to User and Intrface.
bigFont
The number for a large font.
volume
Sound volume on supported machine.
version
The SCI version string.
locales
Set of current locales.
curSaveDir
Address of current save drive/directory string.
aniThreshold
perspective
The Player's viewing angle. This is set according to the Rooms picAngle property. Degrees away from vertical along y axis.
features
Locations that may respond to events.
sortedFeatures
The features and cast sorted by "visibility" to ego.
useSortedFeatures
If TRUE enable cast & feature sorting.
egoBlindSpot
Used by sortCopy for sortedFeatures to exclude actors behind ego within angle from straight behind. Default zero is no blind spot.
overlays
The overlay List.
doMotionCue
A motion cue has occured - process it. The Games doit method gives the motionCue: message to each element of the cast if this is set to TRUE.
systemWindow
ID of standard system window. If you wish to supply your own window for system messages set this to the ID of your window.
lastSysGlobal
Defines the end of Global variable space.
- Notes
< Previous: The Code Class Next: Index >