SpecialVerb class | parser.t[5853], english.t[6446]

A SpecialVerb allows us to define grammar for verbs applying to only a handful of objects in our game, where we want the rarely used command to be translated into a common one, e.g. RIMG BELL -> PUSH BELL, which we could implement as:

SpecialVerb 'ring' 'push' @doorbell

`class SpecialVerb : object`

Superclass Tree (in declaration order)

`SpecialVerb`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`articles during exclusions matchObjs prepositions priority score specVerb stdVerb tentativeDobj tentativeDobjList verbPhrase when where`

Summary of Methods

`checkSV customChecks failCheck initSpec matches matchExclusions objAfterChecks objChecks showFailureMsg vocabCheck`

Properties

`articles` | `english.t[6454]`

a list of articles we want the SpecialVerb to ignore when matching vocab.

`during` | `parser.t[5880]`

A Scene or list of Scenes that must be happening for this SpecialVerb to apply.

`exclusions` | `parser.t[6194]`

Verb phrases we want to exclude from matching, e.g. 'pick up' if our specVerb is 'pick'

`matchObjs` | `parser.t[5871]`

The object ot objects we want this SpecialVerb to apply to. This can be a single object or class or list of objecta and/or classes, but it should result only in a small number of matches.

`prepositions` | `english.t[6451]`

A list of prepositions we want SpecialVerb to check for when detecting the possible end of a noun phrase.

`priority` | `parser.t[5907]`

The priority we want to assign this SpecialVerb if the library needs to break a tie between two or more SpecialVerbs that might otherwise be matched after all other conditions have been applied. The default is 100. Other things being equal, the SpecialVerb with the higher/highest priority will be matched.

`score` | `parser.t[6191]`

Our adjusted priority after attempting a match.

`specVerb` | `parser.t[5858]`

The word or words this SpecialVerb should match, e.g. 'ring'. Different forms can be listed separated by a vertical bar, e.g. 'cross|go across|walk across'

`stdVerb` | `parser.t[5864]`

The verb words needed to trigger the action we want this SpecialVerb to perform, e.g. 'push' or 'go through'

`tentativeDobj` | `parser.t[5913]`

Our best guess at the direct object of the command this SpecialVerb will match before the objects of the command have been fully resolved.

`tentativeDobjList` | `parser.t[5920]`

A list of the possible tentative direct objects of the command this SpecialVerb eill match before the objecs of the command have been fully resolved. This will be all the objects in scope that match our matchObjs property and the noun phrase the player apparently entered.

`verbPhrase` | `parser.t[5924]`

The verb phrase that's been matched to invoke this SpecialVerb.

`when` | `parser.t[5888]`

A condition that must be true for this SpecialVerb to apply. This cannot refer to the objects involved in the command (e.g. dobj or iobj) since these won't be known the first time the when condition is tested. For conditions involving the dobj, iobj, or aobj of a the current command, use objCheck() instead.

`where` | `parser.t[5877]`

A Room, Region or list of Rooms and/or Regions where this SpecialVerb is applicable. Note we'd very rarely need to specficy this since SpecialVerb already makes scope checks.

Methods

`checkSV (lst, svPhrase)` | `parser.t[5934]`

This method is called once the command has been resolved and we kmow the objects involved in it. lst is a list containing the action followed by the objects involved in the action, e.g. [action, dobj]. svPhrase is the special verb phrase that's been translated into another action, e.g. 'ring' or 'walk across'

`customChecks (lst?)` | `parser.t[6125]`

This method is called twice, first when the specialVerbMgr is seeking the best SpecialVerb option to match, and the second once the objects of the revised command have been identified and the command is about to be executed. The first time round the lst parameter won't be supplied (so will be effectively nil); the second time it will be a list containing the action and its objects. The customChecks() method uses this simply to determine at which stage its being invoked. The first time its being asked to adjust the match score; the second time its being asked to check whether or not the proposeed action should be allowed to proceed.

`failCheck (svPhrase)` | `parser.t[5954]`

Display a messsage saying the command can't proceed and then stop it in its tracks. svPhrase is the command we matched, e.g. 'ring' or 'walk over'.

`initSpec ( )` | `parser.t[5970]`

Initialise (in fact preinitialize) this SpecialVerb

`matches (scope_, toks)` | `parser.t[6015]`

Check whether this SpecialVerb matches its conditions.

`matchExclusions (tokWords)` | `parser.t[6197]`

Check whether the command entered by the player matches an item in our exclusions list.

`objAfterChecks (lst)` | `parser.t[6180]`

Checks involving the objects of the commmand, once we know them

`objChecks (dobj, iobj, aobj)` | `parser.t[5896]`

A check that can be applied once the objects involved in the command are known, (e.g. to check whether dobj.isOpen). The method can return nil to reject the command at this stage, or else display a message to explain why it can't go ahead and then use abort to stop it. It's unlikely that this will be needed often.

`showFailureMsg (svPhrase)` | `parser.t[5964]`

Display our failure message. By default this is "You can't <<svPhrase>> that.

`vocabCheck (scope_, toks)` | `parser.t[6032]`

Check how well any objects in soope that match our matchObjs also match the noun phrase we think the player entered.

Adv3Lite Library Reference Manual
Generated on 08/12/2025 from adv3Lite version 2.2.2