exec.t file | source file

TADS 3 Library: command execution

This module defines functions that perform command execution.

Summary of Classes

`AbortImplicitSignal ExitActionSignal ExitSignal GlobalRemapping MessageResult RemapActionSignal`

Summary of Global Objects

(none)

Summary of Global Functions

`_nestedAction _newAction _replaceAction _tryImplicitAction execNestedAction executeAction executeCommand nestedActionAgain newActionObj prepareNestedAction remapAction remapActionCreate remapVerify resolveAndReplaceAction withActionEnv`

Global Functions

`_nestedAction (isReplacement, actor, actionClass, [objs])` | `exec.t[1123]`

Run a nested action. 'isReplacement' has the same meaning as in execNestedAction().

`_newAction (transcriptClass, issuingActor, targetActor, actionClass, [objs])` | `exec.t[1065]`

Run an action as a new turn. Returns the CommandTranscript describing the action's results.

`_replaceAction (actor, actionClass, [objs])` | `exec.t[1030]`

Run a replacement action.

`_tryImplicitAction (issuingActor, targetActor, msgProp, actionClass, [objs])` | `exec.t[925]`

Try an implicit action.

Returns true if the action was attempted, whether or not it succeeded, nil if the command was not even attempted. We will not attempt an implied command that verifies as "dangerous," since this means that it should be obvious to the player character that such a command should not be performed lightly.

`execNestedAction (isReplacement, isRemapping, actor, action)` | `exec.t[1151]`

Execute a fully-constructed nested action.

'isReplacement' indicates whether the action is a full replacement or an ordinary nested action. If it's a replacement, then we use the game time taken by the replacement, and set the enclosing action (i.e., the current gAction) to take zero time. If it's an ordinary nested action, then we consider the nested action to take zero time, using the current action's time as the overall command time.

'isRemapping' indicates whether or not this is a remapped action. If we're remapping from one action to another, this will be true; for any other kind of nested or replacement action, this should be nil.

`executeAction (targetActor, targetActorPhrase, issuingActor, countsAsIssuerTurn, action)` | `exec.t[777]`

Execute an action, as specified by an Action object. We'll resolve the nouns in the action, then perform the action.

`executeCommand (targetActor, issuingActor, toks, firstInSentence)` | `exec.t[33]`

Execute a command line, as issued by the given actor and as given as a list of tokens.

If 'firstInSentence' is true, we're at the start of a "sentence." The meaning and effect of this may vary by language. In English, a sentence ends with certain punctuation marks (a period, semicolon, exclamation mark, or question mark), so anything after one of these punctuation marks is the start of a new sentence. Also in English, we can address a command to an explicit target actor using the "actor," prefix syntax, which we can't use except at the start of a sentence.

If the command line consists of multiple commands, we will only actually execute the first command before returning. We'll schedule any additional commands for later execution by putting them into the target actor's pending command queue before we return, but we won't actually execute them.

`nestedActionAgain (action)` | `exec.t[1221]`

Run a previously-executed command as a nested action, re-resolving all of its objects to ensure they are still valid.

`newActionObj (transcriptClass, issuingActor, targetActor, actionObj, [objs])` | `exec.t[1088]`

Run an action as a new turn. This is almost the same as _newAction, but should be used when the caller has already explicitly created an instance of the Action to be performed.

If issuingActor is nil, we'll use the current global issuing actor; if that's also nil, we'll use the target actor.

Returns a CommandTranscript object describing the result of the action.

`prepareNestedAction (isReplacement, isRemapping, action)` | `exec.t[1165]`

Prepare a nested or replacement action for execution.

`remapAction (inResolve, oldRole, remapInfo)` | `exec.t[1437]`

Perform a remapping to a new action. This is normally invoked through the remapTo() macro.

`remapActionCreate (inResolve, oldRole, remapInfo)` | `exec.t[1475]`

Create a new action object for the given remapped action.

`remapVerify (oldRole, resultSoFar, remapInfo)` | `exec.t[1357]`

Remap a 'verify' method for a remapped action. This is normally invoked through the remapTo() macro.

`resolveAndReplaceAction (newAction)` | `exec.t[1045]`

Resolve and execute a replacement action. This differs from the normal replacement action execution in that the action we execute requires resolution before execution.

`withActionEnv (actionClass, actor, func)` | `exec.t[1250]`

Run some code in a simulated Action environment. We'll create a dummy instance of the given Action class, and set up a command transcript, then invoke the function. This is useful for writing daemon code that needs to invoke other code that's set up to expect a normal action processing environment.

TADS 3 Library Manual
Generated on 8/21/2012 from TADS version 3.1.2