TellToAction
[Previous] [Main] [Next]

TellToAction adds handling for an additional command verb, TellToAction.

This translates commands of the form TELL X TO Y or ASK X TO Y into (effectively) X, Y, and thus provides an additional means for the player to issue commands to NPCs (in a way that may seem more natural to some novice players). For example, a player can type:

>tell bob to take the coin

And it will be treated as if the player had typed:

>bob, take the coin

TellToAction is defined as a LiteralTAction; in a command like TELL X TO Y or ASK X TO Y, X is matched to a single direct object (normally an actor) and Y to a literal string. If the direct object is not an actor the command is considered illogical. If it is an actor the literal Y is tokenized and passed to the actor as a command to perform.

There is one complication; if the player types:

>tell bob to follow you

He or she probably wants this treated as

bob, follow me not bob, follow you (which would mean, bob follow yourself).

To cater for this, the action handling in Actor.actionDobjTellToAction replaces every occurence of the token 'you' with 'me' before executing the command. For similar reasons 'herself' or 'himself' is changed into 'yourself' (so that "TELL BOB TO HIT HIMSELF" becomes "BOB, HIT YOURSELF")

To use TellToAction, just include TellToAction.t in your project, after the adv3 library files.