Modal Actions
Modal Actions

Modal Actions

Modal actions are actions that require a mode, or rather, take specific parameters (called "modes") that are not related to anything in the world. Things like:

	go west
	look up
	walk east

...where west, up, and east do not refer to objects in the world, but are specific enough for TAME to check the validity of.

Declaration


	action [MODIFIERS] modal [IDENTIFIER] [NAME_CLAUSE] [MODES_CLAUSE] ;
[MODIFIERS] An optional declaration of one or more additional modifiers for action behavior.

strict: Apply "strict behavior" to the handling of this action. "Strict" modal actions do not tolerate additional things typed at the interpreter past a valid parsed mode after the action.
[IDENTIFIER] An internal identifier that represents this action in the rest of TAMEScript. This is used to find what entry blocks throughout the code should be executed when a name associated with this action is parsed by the interpreter or when a specific action is queued by another command. This identifier must not be used to describe another element.
[NAME_CLAUSE] The keyword named followed by a comma-delimited list of strings that the interpreter is supposed to associate with this command. The compiler does not check for name duplicates - equivalent names overwrite their association. Names, internally, are sanitized to what the interpreter accepts.

This clause is optional - if no names are declared, this is not parse-able in the interpreter. Leaving this out is a way to make "private" actions.
[MODES_CLAUSE] After the list of action names, the keywords uses modes are required as well as a comma-delimited list of strings that the interpreter uses as valid modes for the action.

Unlike the [NAME_CLAUSE], this is still mandatory.

The following are a few examples of modal action declarations:


	action modal a_go named "go", "travel" uses modes "north", "south", "west", "east";
	action strict modal a_select named "select" uses modes "1", "2", "3";
	action modal a_update uses modes "items", "people";

Modal actions are handled by the current room, the current player, or the world, via the onModalAction(...) block on that element. If that block does not exist, a different block will be called to handle it.

Modal Actions

Modal Actions

×

Modal Header