PresentLaterclass
A mix-in class for objects that don’t come into play until some future event. This class lets us initialize these objects with their *eventual* location, using the standard ‘+’ syntax, but they won’t actually appear in the given location until later in the game. During pre-initialization, we’ll remember the starting location, then set the actual location to nil; later, the object can be easily moved to its eventual location by calling makePresent().
class
PresentLater
: object
Superclass Tree (in declaration order)
PresentLater
` object`
Subclass Tree
(none)
Global Objects
(none)
Summary of Properties
eventualLocation
initiallyPresent
plKey
Summary of Methods
initializeLocation
makePresent
makePresentByKey
makePresentByKeyIf
makePresentIf
Properties
eventualLocation
our eventual location
initiallyPresent
Flag: are we present initially? By default, we’re only present later, as that’s the whole point. In some cases, though, we have objects that come and go, but start out present. Setting this property to true makes the object present initially, but still allows it to come and go using the standard PresentLater mechanisms.
plKey
My “key” - this is an optional property you can add to a PresentLater object to associate it with a group of objects. You can then use makePresentByKey() to move every object with a given key into the game world at once. This is useful when an event triggers a whole set of objects to come into the game world: rather than having to write a method that calls makePresent() on each of the related objects individually, you can simply give each related object the same key value, then call makePresentByKey() on that key.
You don’t need to define this for an object unless you want to use makePresentByKey() with the object.
Methods
initializeLocation ( )
no description available
makePresent ( )
bring the object into the game world in its eventual location(s)
makePresentByKey (key)
Bring every PresentLater object with the given key into the game. Note that this is a “class” method that you call on PresentLater itself:
PresentLater.makePresentByKey(‘foo’);
makePresentByKeyIf (key, cond)
Bring every PresentLater object with the given key into the game, or move every one out of the game, according to the condition ‘cond’.
If ‘cond’ is a function pointer, we’ll invoke it once per object with the given key, passing the object as the parameter, and use the return value as the in game/out of game setting. For example, if you wanted to show every object with key ‘foo’ AND with the property ‘showObj’ set to true, you could write this:
PresentLater.makePresentByKeyIf(‘foo’, {x: x.showObj});
Note that this is a “class” method that you call on PresentLater itself.
makePresentIf (cond)
make myself present if the given condition is true; otherwise, remove me from the game world (i.e. move me into nil)
TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3