RemapCmd class | remapcmd.t[65]

RemapCmd is similar a Doer in that it remaps one command into another command, but there the differences end. What are the differences?

RemapCmd parses up the cmd and does not make any attempt to map them to existing objects in the game. Rather, it builds all the possible variations (by the use of "|", "(" and ")" operators) and then matches that against the user input FIRST before any other routines get a whack at it. You can also provide two or more disjoint phrases that are separated by semi-colon ";" to provide additional phrases that match.

If a match is found against a RemapCmd, it will then act on it. There are three different ways top operate on it.

- provide a complete text phrase replacement (remappedCmd, or use template) - if no replacement text phrase is provided, the execute() routine is run for that object; within that execute routine, you have two possibilities * emit some messages to the console via say() or "..." * use doInstead(action[,dobj[,iobj[,aobj]]]) within to execute that resolved command instead - NOTE: If text phrase is present, execute() will NOT be run!

Note that RemapCmd does not accept wildcards or punctuation of any sort other than "," and "'" -- and ";" to separate distinct input phrases.

`class RemapCmd : object`

Superclass Tree (in declaration order)

`RemapCmd`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`cmd cmdTermHash cmdTerms doInsteadItems during remappedCmd turnsTaken when where`

Summary of Methods

`doInstead execute execute_ turnSequence`

Properties

`cmd` | `remapcmd.t[67]`

The command text to be recognized (see above)

`cmdTermHash` | `remapcmd.t[169]`

The hash for these strings (faster compare later). For internal use only.

`cmdTerms` | `remapcmd.t[166]`

The strings that are the command(s) to match. For internal use only.

`doInsteadItems` | `remapcmd.t[130]`

A list containing the actoin and objects defined by a call to doInstead in our execute routine, or nil if doInstead() wasn't used. For internal use only

`during` | `remapcmd.t[94]`

A scene that must be happening, or list one of scenes of which must be happening for this to happen (nil if no scene is required)

`remappedCmd` | `remapcmd.t[73]`

The remapped (replacement) text (if provided). This should be in the form of a command the parser can parse and exectute

`turnsTaken` | `remapcmd.t[102]`

By default, you generally want any non-system command to take a turn. However, there may also be other circumstances where a turn should not be consumed. Change to 0 if we want execute() to NOT count as a turn. This property is ignored if doInstead(...) is called within execute()

`when` | `remapcmd.t[88]`

An expression defining under what circumstances this RemapCmd is matched.

`where` | `remapcmd.t[85]`

where this can happen (nil if everywhere); can be Room/Region or list of Rooms and/or Regions.

Methods

`doInstead (action, [args])` | `remapcmd.t[136]`

Populate our doInsteadItems from any call to doInstead() in our execute() routine. For internal use only.

`execute ( )` | `remapcmd.t[79]`

If remapped command is NOT provided, game code should override this method to do something (or display some text).

`execute_ ( )` | `remapcmd.t[109]`

Execute our custom method and then our turn sequence. For internal use only.

`turnSequence ( )` | `remapcmd.t[121]`

If doInstead has been used in our execute() method, then call the standard turn sequence routine to execute any Events and update the turn counter. For internal use only.

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