#variable

Syntax: #variable {<variable_name>} {<value>} [local/global]

    This command creates a global variable and populates it with <value>. This variable stays valid between command processing and may be used to keep data between actions/aliases. The variable's name should start with a letter. To use the variable's value you have to type the '$' character followed by the variable name. Variables can be used as a part of any command or as a part of any string.

    There are predefined variables in JMC: DATE and TIME. You cant set those variables but you can use them into your scripts. DATE variable contains current date and TIME variable contains current time.

By default variable creates as local and stores in your pofile’s .set file. If you set global flag variable will be stored into globa.set file and will be availible for all profiles.

Example:

#variable food {bread} {global}

Created variable named 'food' which contains the string "bread". Will be stored in globa.set file and availible for all profiles.

#variable container chest

Created variable named 'container' which contains the string "chest". Will be availible for current profile only.

#action {You are hungry.} {get $food $container;eat $food}

With that action defined, you will get a bread from the chest, and eat it, if the "You are hungry." message ever arrives on your screen. If you have alternate foodstuffs (if the city you are now in doesn't sell bread for example) you simply change the name of the variable to the food you are now carrying.

#log $DATE.log

Opens log file with name like "01-02-2001.log"

You can use variables in #math and #if commands:

Example:

#variable hp 100

#action {HP:%1} {#variable hp %1 ; #if {$hp<100} {#showme TIME TO FLEE!}}

See also: #unvariable, #math, #if JMC commands groups #group