Actionclass | action.t[22], english.t[5265]

The library doesn't yet provide any support for actions that take three objects (TIAActions, as they might hypothetically be called), but since the Mercury parser does we provide a number of hooks that other code could use. To this end we need to define the properties a TIAAction might use so the compiler recognizes them.

Modified in english.t[5265]:
Language-specific modifications to Action classes principally to enable the construction of implicit action announcements.

`class Action : ReplaceRedirector`

Superclass Tree (in declaration order)

`Action`
`ReplaceRedirector`
`Redirector`
`object`

Subclass Tree

`Action`
`IAction`
`LiteralAction`
`MiscConvAction`
`NumericAction`
`SystemAction`
`FileOpAction`
`TopicAction`
`ImplicitConversationAction`
`TAction`
`LiteralTAction`
`NumericTAction`
`TIAction`
`TopicTAction`
`TravelAction`

Global Objects

`Record RecordEvents RecordEventsString RecordString Replay ReplayString RestoreString Save SaveString ScriptOn ScriptString`

Summary of Properties

`actionFailed againRepeatsParse allowAll extraMessageParams failCheckMsg includeInUndo isImplicit isRepeatable oldRoom parentAction parentAllowAll preCond redirectParent reportImplicitActions scopeList spellingPriority synthParamID turnsTaken unhides verifyObj wasIlluminated`

``

``

Summary of Methods

`acknowledgeNotifyStatus addExtraScopeItems addImplicitTime advanceTime afterAction announceObject beforeAction buildImplicitActionAnnouncement buildScopeList checkAction checkActionPreconditions commandNotPresent exec execAction execCycle execGroup getAll getAllUnhidden getMessageParam implicitAnnouncement reportAction scoreObjects setMessageParam setMessageParams spPrefix spSuffix synthMessageParam turnSequence verify verifyObjRole wrapObjectsNP`

Inherited from `ReplaceRedirector` :
`redirect`

Inherited from `Redirector` :
`doInstead doNested doOtherAction`

Properties

`actionFailed` | `action.t[29]`

Flag; should this action be considered a failure? This should be reset to true at the start of the action processing cycle but can be tested later to prevent, e.g., inappropriate reporting.

`againRepeatsParse` | `action.t[374]`

If an AGAIN command is used with this command, should the command be reparsed from scratch (because it might involve a different object) or not (because it should act on the same objects). We generally set this to true for actions it wouldn't normally make sense to repeat on the same object straight away. Since this applies to the majority of actions, we make this the default.

`allowAll` | `action.t[923]`

Can ALL be used with this action? By default we take our value from gameMain.allVerbsAllowAll, though basic inventory-handling actions in the library will override this. This property is really only relevant on TAction and its descendents, but we define it here just to make sure no cases are missed.

`extraMessageParams` | `action.t[734]`

Extra message parameters. If a message processor wants to add special message parameters of its own, we'll create a lookup table for the extra parameters. Message processors might want to add their own special parameters to allow referring to objects other than the main objects of the command.

`failCheckMsg` | `action.t[939]`

The message to display if an action fails at the check stage (via an exit macro) without any other explanatory text being displayed.

`includeInUndo` | `action.t[356]`

Can this action be Undone? By default most actions can.

`isImplicit` | `action.t[353]`

Flag: is this an implicit action? By default it isn't.

`isRepeatable` | `action.t[363]`

Is this action repeatable (with an AGAIN command)? Most actions are so the default is true but subclasses can override to exclude actions (such as certain system actions) that it would make no sense to repeat.

`oldRoom` | `action.t[136]`

The room the actor was in when the action started

`parentAction` | `action.t[393]`

Do we have a parent action, and if so what is it? The parent action would be the action that's using us as an implicit action or nested action.

`parentAllowAll` | `action.t[932]`

Does the command from which we've been redirected allow ALL?

`preCond` | `action.t[146]`

A list of any PreConditions that apply to this action as a whole, as opposed to any of its objects. This is most likely to be relevant to an IAction.

`redirectParent` | `action.t[929]`

If we've been redirected here from another action, store a reference to that action.

`reportImplicitActions` | `english.t[5294]`

Flag - do we want to show implicit action reports for this action? By default we do.

`scopeList` | `action.t[911]`

Our currently cached list of items in scope for this action.

`spellingPriority` | `action.t[914]`

Used by Mercury's spelling corrector code.

`synthParamID` | `action.t[725]`

synthesized message object parameter serial number

`turnsTaken` | `action.t[350]`

The number of turns this action is counted as taking. Normally, this will be 1.

`unhides` | `action.t[961]`

Flag: is this an action that acts on an object even if it is hidden; normally this will only apply to debugging actions.

`verifyObj` | `action.t[638]`

The object currently being verified

`wasIlluminated` | `action.t[139]`

Flag to indicate whether the actor's location started out illuminated

Methods

`acknowledgeNotifyStatus (stat)` | `action.t[951]`

acknowledge a change in the score notification status

`addExtraScopeItems (role?)` | `action.t[905]`

Add extra scope items if this action needs a wider definition of scope than normal. By default we simply allow the current actor's current location to add additional items to scope if it wishes to.

`addImplicitTime ( )` | `action.t[967]`

This does nothing in the main library but is provided as a hook for the objtime extension to use to add to the time taken by implicit actions.

`advanceTime ( )` | `action.t[973]`

Advance the game clock time. This does nothing in the main library but is provided as a hook for the objtime extension to use.

`afterAction ( )` | `action.t[263]`

Carry out the post-action processing. This first checks to see if there's been a change in illumination. If there has we either show a room description (if the actor's location is now lit) or announce the onset of darkness. We then call the after action notifications first on the actor's current room and then on every object in scope.

Note that afterAction() is called from the current Command object.

`announceObject (obj)` | `english.t[5414]`

Announce an object (for use to introduce a report on what an action does to particular object when it's one of a number of objects the actions is acting upon)

`beforeAction ( )` | `action.t[209]`

Return our overall check result.

`buildImplicitActionAnnouncement (success, clearReports, =, true)` | `english.t[5303]`

Construct the announcement of an implicit action according to whether the implict action succeeds (success = true) or fails (success = nil)

[Required]

`buildScopeList (whichRole, =, DirectObject)` | `action.t[889]`

Build the scope list for this action.

`checkAction ( )` | `action.t[46]`

The checkAction() method calls the check routines on the objects involved in the command (where there are objects). Subclasses such as TAction and TIAction need to override this to carry out the appropriate handling.

`checkActionPreconditions ( )` | `action.t[148]`

no description available

`commandNotPresent ( )` | `action.t[943]`

optional command is not supported in this game

`exec (cmd)` | `action.t[53]`

The main routine for handling an action. This is the method called by the command object; the cmd parameter gives the calling Command object.

`execAction (cmd)` | `action.t[131]`

The main action handler. Subclasses must override.

`execCycle (cmd)` | `action.t[88]`

The action-processing cycle carries out the before action notifications, then executes the action. This needs to be overridden on various subclasses since the beforeAction notifications can occur at different points in different kinds of action.

`execGroup (cmd)` | `action.t[38]`

The execGroup() method is called by the current Command object before it calls the action on individual objects, to allow processing of the group of objects as a whole. By default we do nothing here in the library.

`getAll (cmd, role)` | `action.t[744]`

Get a list of all the objects that this action should act on if the player typed ALL for role (DirectObject, IndirectObject, or perhaps in some future version of the library, AccessoryObject. This is the method that can be overridden on subclasses to give action-specific definitions of ALL.

`getAllUnhidden (cmd, role)` | `action.t[758]`

Get a list of all the objects this action will act on if the player types ALL for role (DirectObject or IndirectObject). This is the method actually called by the Parser. We first obtain the list of objects returned by getAll() and then filter out any objects for which hideFromAll(action) is true for this action. Subclasses should normally override getAll() rather than this method.

`getMessageParam (objName)` | `action.t[646]`

Get a message parameter object for the action. Each action subclass defines this to return its objects according to its own classifications. The default action has no objects, but recognizes 'actor' as the current command's actor.

`implicitAnnouncement (success)` | `english.t[5396]`

Return a string giving the implicit action announcement for the current action according to whether it's a success (e.g. "taking the spoon") or a failure (e.g. "trying to take the spoon"). We make this a separate method to make it a little easier for game code to customize implicit action announcements.

A return value of nil will suppress the implicit action report for this action altogeher.

`reportAction ( )` | `action.t[385]`

Report on the action. This is only relevant where the action has more or one objects, so TAction must override. This is called from the current Command object once all the objects have been acted on (in a case where multiple direct objects have been specified, as in TAKE ALL or TAKE RED BALL AND GREEN PEN). This allows the report routine to summarize the action for all the objects acted upon instead of displaying an individual report for each one.

`scoreObjects (cmd, role, lst)` | `action.t[804]`

Score a set of objects in a given noun role in the action, in order to resolve an ambiguous command. Our job, in brief, is to READ THE PLAYER'S MIND: we want to figure out which object or objects the player is actually referring to when their words are ambiguous.

'cmd' is the Command object describing the command. The various object lists (dobjs, iobjs, accs) have been filled in with the in-scope objects that match the noun phrase, but these haven't been disambiguated yet, so there might be more objects listed than will actually be used in the final command.

'role' tells us the noun phrase role that we're scoring (DirectObject, IndirectObject, AccessoryObject, TopicRole, LiteralRole).

'lst' is the match list. This is a Vector containing NPMatch objects. There's one NPMatch for each object that we're considering as a match for the player's noun phrase.

For each item in the match list, we must set the NPMatch object's 'score' property to a number indicating how likely we think it is that the player is referring to this object. The higher the score, the more likely we think it is. The score value is purely relative - the caller will pick the object or objects with the highest score.

We run through the verify routine for each object, which in turn runs through the preconditions of that object. We take the returned verify score to be the score for the object (or its replacement if remapping took place).

Next, we do any verb-specific adjustments via self.actionScore().

Finally, we call each object's scoreObject() routine to give the object a chance to make any adjustments for special affinities (or aversions).

`setMessageParam (objName, obj)` | `action.t[682]`

Define an extra message-specific parameter. Message processors can use this to add their own special parameters, so that they can refer to parameters that aren't involved directly in the command. For example, a message for "take <dobj>" might want to refer to the object containing the direct object.

`setMessageParams ([lst])` | `action.t[699]`

For convenience, this method allows setting any number of name/value pairs for message parameters.

`spPrefix (str)` | `english.t[5406]`

add a space prefix/suffix to a string if the string is non-empty

`spSuffix (str)` | `english.t[5407]`

no description available

`synthMessageParam (obj)` | `action.t[710]`

Synthesize a global message parameter name for the given object. We'll store the association and return the synthesized name.

`turnSequence ( )` | `action.t[329]`

The turnSequence() method is called from the current Command object. It first executes any current daemons (apart from any PromptDaemons) and then advances the turn counter. We define this on the Action class principally to make it simple for certain kinds of Action such as SystemActions to do nothing here (since they don't count as actions within the game world).

`verify (obj, role)` | `action.t[402]`

Carry out the verification stage for this object in this role, and carry out any remapping needed. This needs to be defined on Action since there might be verification of the ActorRole.

`verifyObjRole (obj, role)` | `action.t[566]`

Run the verify routine on the current object in the current role to see whether it will allow the action. If it won't, display any pending implicit action announcements, then display the message explaining why the action is disallowed, and finally return nil to tell our caller to halt the action. If the verify stage does allow the action to go ahead, return true to tell our caller that this routine has no objection.

`wrapObjectsNP (lst)` | `action.t[876]`

Wraps a list of objects in NPMatch objects so they can be run through the scoreObjects method.

Adv3Lite Library Reference Manual
Generated on 28/03/2016 from adv3Lite version 1.5