|
|
|
In zMUD, the #VAR command would expand variable references, but would not evaluate any expressions. To evaluate an expression, you had to use either the [] syntax that no longer exists in CMUD, or the %eval function was used, or you used the #MATH command instead of the #VAR command. This caused a lot of confusion for new users.
In CMUD, the #VAR command will evaluate expressions as expected. To prevent this evaluation, put {} around the value. In CMUD, {} works similar to "" quotes. The difference is that variables are expanded within {}, but not expanded within "".
For example:
Code: |
zMUD:
a = 2
#VAR b @a+1 ; actually stores "2+1" in @b
#FUNC b @a+1 ; stores "@a+1" in @b
#MATH b @a+1 ; stores 3 in @b
CMUD:
a = 2
#VAR b @a+1 ; stores 3 in @b
#VAR b {@a+1} ; stores "2+1" in @b
#VAR b "@a+1" ; stores "@a+1" in @b
#VAR b (@a+1) ; stores 3 in @b |
The #MATH command can still be used in CMUD - #VARFUNC is the equivalent of the zMUD command #FUNC |
|