Introduction to Variables

Variables are very similar to aliases. The important difference between aliases and variables is that aliases are only expanded when at the beginning of a command, while variables are expanded anywhere. To expand the variable, you precede its name with the @ character. Note that this is different then TINTIN where variables start with a $. You can change the variable character in the Preferences dialog if you wish.

To define a variable, you still use the #VARIABLE command. For example, #VAR container waterskin stores the string ‘waterskin’ into the variable container. To return the contents of the variable, precede its name with the @ character. For example, fill @container would expand to fill waterskin.

Another assignment syntax is also provided. As with some programming languages, you can use the syntax variable=value to assign a value to a variable. All variables are stored internally as character strings, just like aliases.

So, the illustrate the use of variables, with the variable @container defined as shown above, you could now create an alias #ALIAS fs {fill @container statue}. Now when you enter fs on the command line, the current value of the container variable (waterskin from the above example) is expanded and the command fill waterskin statue is sent to the MUD.

Variables are only expanded in the command line when the Expand Vars option is turned on in the General Preferences. If Expand Vars is turned off and you want to expand a variable in the command line, enclose the variable reference in angle brackets (<>). For example, if you type fill @container on the command line, fill @container will be sent to the MUD. However, if fill @container is being executed within an alias or script, then it will be properly expanded. To force it to expand on the command line, you would enter fill <@container> or turn on the Expand Var option.

System Variables

There are also several predefined system variables that are maintained by the system. These variables all begin with the parameter (%) character. Changing temporary variables does not change the modified status of your settings file, so you aren't prompted to save your settings when you exit. These system variables are used just like regular variables, except with the % character instead of the @ character.



Contents Introduction to Aliases Introduction to Paths