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
a list of articles we want the SpecialVerb to ignore when matching vocab.
A Scene or list of Scenes that must be happening for this SpecialVerb to apply.
Verb phrases we want to exclude from matching, e.g. 'pick up' if our specVerb is 'pick'
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.
A list of prepositions we want SpecialVerb to check for when detecting the possible end of a noun phrase.
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.
Our adjusted priority after attempting a match.
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'
The verb words needed to trigger the action we want this SpecialVerb to perform, e.g. 'push' or 'go through'
Our best guess at the direct object of the command this SpecialVerb will match before the objects of the command have been fully resolved.
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.
The verb phrase that's been matched to invoke this SpecialVerb.
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.
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
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'
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.
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'.
Initialise (in fact preinitialize) this SpecialVerb
Check whether this SpecialVerb matches its conditions.
Check whether the command entered by the player matches an item in our exclusions list.
Checks involving the objects of the commmand, once we know them
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.
Display our failure message. By default this is "You can't <<svPhrase>> that.
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 03/07/2024 from adv3Lite version 2.1