SpecialVerbclassparser.t[5805]

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  

during  matchObjs  priority  score  specVerb  stdVerb  verbPhrase  when  where 

Summary of Methods  

checkSV  customChecks  failCheck  initSpec  matches  objAfterChecks  objChecks  scopeCheck  showFailureMsg 

Properties  

duringparser.t[5832]

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

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

priorityparser.t[5859]
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[6052]
Our adjusted priority after attempting a match.

specVerbparser.t[5810]
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[5816]
The verb words needed to trigger the action we want this SpecialVerb to perform, e.g. 'push' or 'go through'

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

whenparser.t[5840]
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[5829]
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[5872]

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[5986]
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[5892]
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[5908]
Initialise (in fact preinitialize) this SpecialVerb

matches (scope_)parser.t[5947]
Check whether this SpecialVerb matches its conditions.

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

objChecks (dobj, iobj, aobj)parser.t[5848]
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.

scopeCheck (scope_)parser.t[5962]
Check whether any of the items this SpecialVerb is meant to match is in scope.

showFailureMsg (svPhrase)parser.t[5902]
Display our failure message. By default this is "You can't <<svPhrase>> that.

Adv3Lite Library Reference Manual
Generated on 02/05/2024 from adv3Lite version 2.0