SpecialVerbclassparser.t[5838], english.t[6165]

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  

articlesenglish.t[6173]

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

duringparser.t[5865]
A Scene or list of Scenes that must be happening for this SpecialVerb to apply.

exclusionsparser.t[6179]
Verb phrases we want to exclude from matching, e.g. 'pick up' if our specVerb is 'pick'

matchObjsparser.t[5856]
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.

prepositionsenglish.t[6170]
A list of prepositions we want SpecialVerb to check for when detecting the possible end of a noun phrase.

priorityparser.t[5892]
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.

scoreparser.t[6176]
Our adjusted priority after attempting a match.

specVerbparser.t[5843]
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'

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

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

tentativeDobjListparser.t[5905]
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.

verbPhraseparser.t[5909]
The verb phrase that's been matched to invoke this SpecialVerb.

whenparser.t[5873]
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.

whereparser.t[5862]
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[5919]

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[6110]
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[5939]
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[5955]
Initialise (in fact preinitialize) this SpecialVerb

matches (scope_, toks)parser.t[6000]
Check whether this SpecialVerb matches its conditions.

matchExclusions (tokWords)parser.t[6182]
Check whether the command entered by the player matches an item in our exclusions list.

objAfterChecks (lst)parser.t[6165]
Checks involving the objects of the commmand, once we know them

objChecks (dobj, iobj, aobj)parser.t[5881]
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[5949]
Display our failure message. By default this is "You can't <<svPhrase>> that.

vocabCheck (scope_, toks)parser.t[6017]
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