Library global variables

libGlobal :   object

Superclass Tree   (in declaration order)


Summary of Properties  

actorVisualAmbientCache  allSenses  canTouchCache  commandLineArgs  connectionCache  curAction  curActor  curIssuingActor  curVerifyResults  exitListerObj  footnoteClass  hintManagerObj  IFID  lastActorForUndo  lastCommandForUndo  libMessageObj  parserDebugMode  playerChar  pointOfView  pointOfViewActor  povStack  scoreObj  senseCache  totalTurns 

Summary of Methods  

disableSenseCache  enableSenseCache  getCommandSwitch  invalSenseCache 



Actor visual ambient cache - this keeps track of the ambient light level at the given actor.

List of all of the senses. The library pre-initializer will load this list with a reference to each instance of class Sense.

Can-Touch cache - we keep CanTouchInfo entries here, keyed by [from,to]. This cache is the touch-path equivalent of the sense cache, and is enabled and disabled

Command line arguments. The library sets this to a list of strings containing the arguments passed to the program on the command line. This list contains the command line arguments parsed according to the local conventions for the operating system and C++ library. The standard parsing procedure used by most systems is to break the line into tokens delimited by space characters. Many systems also allow space characters to be embedded in tokens by quoting the tokens. The first argument is always the name of the .t3 file currently executing.

Connection list cache - this is a cache of all of the objects connected by containment to a given object.

no description available

Current command information. We keep track of the current command's actor and action here, as well as the verification result list and the command report list.

no description available

no description available

the exitLister object, if included in the build

The global Footnote class object. We use a global for this, rather than referencing Footnote directly, to allow the footnote module to be left out entirely if the game doesn't make use of footnotes. The footnote class should set this during pre-initialization.

the hint manager, if included in the build

The game's IFID, as defined in the game's main module ID object. If the game has multiple IFIDs in the module list, this will store only the first IFID in the list. NOTE: the library initializes this automatically during preinit; don't set this manually.

Most recent target actor phrase; this goes with lastCommandForUndo. This is nil if the last command did not specify an actor (i.e., was implicitly for the player character), otherwise is the string the player typed specifying a target actor.

Most recent command, for 'undo' purposes. This is the last command the player character performed, or the last initial command a player directed to an NPC.

Note that if the player directed a series of commands to an NPC with a single command line, only the first command on such a command line is retained here, because it is only the first such command that counts as a player's turn in terms of the game clock. Subsequent commands are executed by the NPC's on the NPC's own time, and do not count against the PC's game clock time. The first command counts against the PC's clock because of the time it takes the PC to give the command to the NPC.

The current library messages object. This is the source object for messages that don't logically relate to the actor carrying out the comamand. It's mostly used for meta-command replies, and for text fragments that are used to construct descriptions.

This message object isn't generally used for parser messages or action replies - most of those come from the objects given by the current actor's getParserMessageObj() or getActionMessageObj(), respectively.

By default, this is set to libMessages. The library never changes this itself, but a game can change this if it wants to switch to a new set of messages during a game. (If you don't need to change messages during a game, but simply want to customize some of the default messages, you don't need to set this variable - you can simply use 'modify libMessages' instead. This variable is designed for cases where you want to *dynamically* change the standard messages during the game.)

flag: the parser is in 'debug' mode, in which it displays the parse tree for each command entered

The current player character

The current perspective object. This is *usually* the actor performing the current command, but can be a different object when the actor is viewing the location being described via an intermediary, such as through a closed-circuit TV camera.

The current perspective actor. This is the actor who's performing the action (LOOK AROUND, EXAMINE, SMELL, etc) that's generating the current description.

The stack of point of view objects. The last element of the vector is the most recent point of view after the current point of view.

The global score object. We use a global for this, rather than referencing libScore directly, to allow the score module to be left out entirely if the game doesn't make use of scoring. The score module should set this during pre-initialization.

Sense cache - we keep SenseInfo lists here, keyed by [pov,sense]; we normally discard the cached information at the start of each turn, and disable caching entirely at the start of the "action" phase of each turn. We leave caching disabled during each turn's action phase because this is the phase where simulation state changes are typically made, and hence it would be difficult to keep the cache coherent during this phase.

When this is nil, it indicates that caching is disabled. We only allow caching during certain phases of execution, when game state is not conventionally altered, so that we don't have to do a lot of work to keep the cache up to date.

the total number of turns so far


disableSenseCache ( )misc.t[1662]

disable the cache

enableSenseCache ( )misc.t[1646]
enable the cache, clearing any old cached information

getCommandSwitch (s)misc.t[1832]
Retrieve a "switch" from the command line. Switches are options specifies with the conventional Unix "-xxx" notation. This searches for a command option that equals the given string or starts with the given substring. If we find it, we return the part of the option after the given substring - this is conventionally the value of the switch. For example, the command line might look like this:

t3run mygame.t3 -name=MyGame -user=Bob

Searching for '-name=' would return 'MyGame', and searching for '-user=' would return' Bob'.

If the switch is found but has no value attached, the return value is an empty string. If the switch isn't found at all, the return value is nil.

invalSenseCache ( )misc.t[1680]
Invalidate the sense cache. This can be called if something happens during noun resolution or verification that causes any cached sense information to become out of date. For example, if you have to create a new game-world object during noun-phrase resolution, this should be called to ensure that the new object's visibility is properly calculated and incorporated into the cached information.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3