|
|
|
In zMUD, the [] characters were used to perform "immediate evaluation" of an expression, and the <> characters were used to perform "immediate expansion" of a string value.
Neither of these two syntaxes are supported in CMUD. In most cases, these were used in zMUD to get around various parser problems that no longer exist in CMUD. In the cases where they were really needed, the new local variables in CMUD can perform a similar function, but in a clearer way.
Getting rid of []
In the vast majority of cases, a zMUD script that uses [] can just remove the [] characters and it will work fine. Unlike with zMUD, CMUD often evaluates expressions more as expected. In cases where this doesn't work, putting parenthesis () around the expression will often cause it to be evaluated. For example:
Code: |
zMUD:
#VAR hp [@maxhp/2]
CMUD:
#VAR hp @maxhp/2
#VAR hp (@maxhp/2) |
Either of the last two examples performs the same function in CMUD.
Getting rid of <>
Again, in many cases, just removing the <> from the zMUD script will work fine. The special case is where the <> characters were being used to immediately expand a variable to be inserted into a new alias or trigger that was being created at runtime.
You can use Local Variables in CMUD to perform immediate expansion or evaluation. For example:
Code: |
zMUD:
#VAR spell "heal"
#ALIAS @spell {cast <@spell>}
CMUD:
$spell = "heal"
#ALIAS $spell {cast $spell} |
In the CMUD example, a local variable called "spell" is created using the new $ operation. The value of this local variable is replaced as soon as it is used in the #ALIAS command. Note that local variables are only available within a script. To use them on the command line, you must put all of the commands on a single line seperated by ; characters.
MXP
Since <> aren't special characters any more, you no longer need to quote the opening triangular bracket:
Code: |
zMUD:
#SAY ~<color red>Hello, world!~</color>
CMUD:
#say <color red>Hello, world!</color> |
|
|