Difference between revisions of "The command parser"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search
(him & her)
m
Line 88: Line 88:
 
<FONT COLOR=#19A58A>
 
<FONT COLOR=#19A58A>
 
The egyptians used to wrap these inside mummy's for protection.</FONT>  
 
The egyptians used to wrap these inside mummy's for protection.</FONT>  
</td><td> When a command refers to a specific object, ADRIFT stores a reference to that object and the
+
</td><td> 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.
next time the player uses the word "it", it is replaced with the name of that object.
+
 
</td></table>
 
</td></table>
 
==== THEM ====
 
==== THEM ====
Line 116: Line 115:
 
<FONT COLOR=#19A58A>
 
<FONT COLOR=#19A58A>
 
The pirate bites the coin to make sure its real, smiles at you, then saunters off.</FONT>  
 
The pirate bites the coin to make sure its real, smiles at you, then saunters off.</FONT>  
</td><td> When a command refers to a specific male character, ADRIFT stores a reference to that character and the
+
</td><td> When a command refers to a specific male character, ADRIFT stores a reference to that character and the next time the player uses the word "him", ADRIFT uses the name of that character.
next time the player uses the word "him", ADRIFT uses the name of that character.
+
 
</td></table>
 
</td></table>
 
==== HER ====
 
==== HER ====
Line 131: Line 129:
 
<FONT COLOR=#19A58A>
 
<FONT COLOR=#19A58A>
 
"This is for you" she says, handing it to you.</FONT>  
 
"This is for you" she says, handing it to you.</FONT>  
</td><td> When a command refers to a specific female character, ADRIFT stores a reference to that character and the
+
</td><td> When a command refers to a specific female character, ADRIFT stores a reference to that character and the next time the player uses the word "her", ADRIFT uses the name of that character.
next time the player uses the word "her", ADRIFT uses the name of that character.
+
 
</td></table>
 
</td></table>

Revision as of 09:04, 29 September 2012

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

> x pirate
He has a wooden leg and a patch over one eye.
> give gold coin to him
The pirate bites the coin to make sure its real, smiles at you, then saunters off.

When a command refers to a specific male character, ADRIFT stores a reference to that character and the next time the player uses the word "him", ADRIFT uses the name of that character.

HER

> x famous author
She is a young woman with long straight hair, wearing an ankle length red dress and carrying a heavy book that has her photo on the back.
> ask her about book
"This is for you" she says, handing it to you.

When a command refers to a specific female character, ADRIFT stores a reference to that character and the next time the player uses the word "her", ADRIFT uses the name of that character.