Commands - jslightham/Zork GitHub Wiki
Commands
Format: CommandWord (argument)
Most commands also have many synonyms that will work in place of the command word, commands are not case sensitive, and the order in which the words are typed in does not matter.
Unlock (direction), Open (direction)
If the player has a lockpick, or key in their inventory this will unlock the door, and allow them to proceed into the next room.
Look
Display the room description, exits, items, and other characters in that room
Take (item)
If the player can carry any more items, remove the item from the inventory of the room and add it to the inventory of the player. The argument can be an item, or the word "all" or "everything" to take all items.
Talk, chat, speak with (Riddler)
If there is a Riddler in the room, entering this command will allow it to ask you a riddle for a reward of a useful item.
Drop (item)
Remove the item from the player's inventory, and add it to the room's inventory.
Inventory, i
Display all items that the player is carrying.
Attack (enemy) with (weapon)
This along with many other synonyms can be used to begin, or continue the combat with the specified enemy. For more information on combat see the combat page.
Eat (item), Devour (item), Consume (item)
If the item is consumable, it will be eaten by the player, by removing it from the player's inventory and adding onto the health of the player. Note: when in combat, this counts as a turn.
Go (direction), (direction)
If not locked, boarded, or restricted by a riddle, advance to the next room in that direction.
Help, ?
Display available commands.
Quit
Leave the game. Warning: all progress will be lost!
Jump
Good Job!
Die
If you insist... Poof! You're gone. You're out of the castle now, but now a new, grand new adventure begins...
Scream
Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhh!
Craft (Item)
If the item specified is craftable, and the player has all the required items to make it, remove the materials from the player's inventory and add the specified item. Currently, there are two items that can be crafted: The Battering Ram (Base, Cylinder, Point) and Bandages (Robes).
Use (Item)
If the item can be used (Bandages), the item will be removed from the player's inventory and will apply their use to the game. Currently the only item that can be used are bandages to stop bleeding.
Exercise
Time to break out those High-Knees and Burpees from that one free-trial HIIT class you tried at your community centre!
Give cookies
There aren't any cookies in Casa Loma. I guess Rattenbury's mentor group won't be getting their Mentor Kindness gift again...
Play
Probably not the best time to play right now...
About the Parser
The parser that was created for Escape Casa Loma can understand a phrase of any amount of words in any order, with many different synonyms of specific command words. To do this, the input line is first broken into tokens which then gets put into a String ArrayList. The ArrayList is then iterated through, index by index to replace any synonyms. The synonyms are stored in a Hashmap with the key as the synonym and the value as the desired word. The word is then run through multiple if statements to determine what type of word it is (verb, direction, item, enemy, riddler, unimportant) and sets a String to its value if it falls into one of those categories, if it is an unknown word it is added to an ArrayList of other words. Once the entire ArrayList is iterated through, a new command object is created with the strings that were set while iterating through the ArrayList which is returned by the parser.