The command parser

From ADRIFT 5 Manual Wiki
Revision as of 08:47, 29 September 2012 by Saabie (Talk | contribs) (One word commands)

Jump to: navigation, search

When the player enters a new command, the words that they type are interpreted by a special program called a "Parser". The parser

One word commands

The simplest commands consist of a single noun. In the standard library this is only used for the most common commands such as moving in a particular direction or looking at your inventory, but you can add more of your own if you wish. As this is usually done to save typing for commands that the player is using regularly, these commands usually have a one or two character abreviation to simplify them even further.

> i
I am wearing a suit and am carrying a bouquet of flowers.

"i" is the abreviation for inventory, and lists everything the players character is wearing and carrying.

> ne
There is no route to the northeast, only north and south.

"ne" is the abreviation for walking to the northeast. If it is not possible to go in that direction then ADRIFT will tell the player which directions they can move towards, from their current location.

Verb+Noun commands

A verb followed by a noun is the most common type of command in interactive fiction.


Special parser key-words

The following keywords are directly decoded by the parser to allow more complex commands to be entered than has been defined in the general tasks.

This allows for more natural commands to be entered, and enables the player to manipulate multiple objects with a single command.

ALL

The ALL keyword can be used anywhere an %object% reference appears in a command. It causes the tasks actions to be executed for every object that would pass the tasks restrictions. The output message of the task is then printed, using a list of those objects where it would normally print the name of a single object.

> get all
Ok, I pick up the floor mat, the red pen and the bouquet of flowers

get all will get every object in the current location that the player is allowed to take.

> drop all
Ok, I put down the floor mat, the red pen and the bouquet of flowers

drop all will drop everything in the players inventory.

AND

The AND keyword lets the player specify several items at once.

> get flowers and mat
Ok, I pick up the floor mat and the bouquet of flowers

Using AND you can perform the same command on two objects at once.

> get scarab, flowers and mat
Ok, I pick up the egyptian scarab, the floor mat and the bouquet of flowers

For more than two objects, separate them with comma's.

EXCEPT

The EXCEPT keyword is usually used with ALL to exclude one or two objects from a large group.

> get all except flowers and mat
Ok, I pick up the red pen, the blue pen and the egyptian scarab

Player gets everything except the objects he excludes.

IT

> get scarab
Ok, I pick up the egyptian scarab. > x it
The egyptians used to wrap these inside mummy's for protection.

When a command refers to a specific object, ADRIFT stores a reference to that object and the

next time the player uses the word "it", it is replaced with the name of that object.

THEM

> get chopsticks
Ok, I pick up some wooden chopsticks. > x them
The chinese prefer to eat with these.

When a command refers to an object that has been defined with the article "some", ADRIFT stores a reference to that object and the next time the player uses the word "them", it is replaced with the name of that object. Note that the "it" and "them" objects are stored separately and will not refer to the same object.

HIM

> get scarab
Ok, I pick up the egyptian scarab. > x it
The egyptians used to wrap these inside mummy's for protection.

When a command refers to a specific object, ADRIFT stores a reference to that object and the

next time the player uses the word "it", it is replaced with the name of that object.

HER

> get scarab
Ok, I pick up the egyptian scarab. > x it
The egyptians used to wrap these inside mummy's for protection.

When a command refers to a specific object, ADRIFT stores a reference to that object and the

next time the player uses the word "it", it is replaced with the name of that object.