| Why are my old MM2000 /if statements not working? |
|
|
|
| Written by Ghoti |
| Tuesday, 25 May 2010 09:36 |
|
There is a very good chance your MM2000 scripts have /if statements which have string variables in them which aren't surrounded by double quotes. Many of the bugs in the /if code of MM2000 have been fixed in MudMaster 2k6 but one result is 2k6 is extremely picky about strings and string variables in /if statements. The simplest way to avoid problems now is to put double quotes around both strings and string variables. So instead of /if {$this == $that}{/showme {this matches that} use /if {"$this" == "$that"}{/showme {this matches that} The other possible problems could be related to /empty MyVar makes MyVar null which is not the same as 0 and variables that haven't been made empty or set to anything yet become strings. Here are some examples to try to explain further. /if {$MyVar = 0}{/showme {true}}{/showme {false}}
/if {$MyVar = $RoomName}{/showme {true}}{/showme {false}}
/if {"$MyVar" = "$RoomName"}{/showme {true}}{/showme {false}} This is because of the mechanics of variable replacement. The $MyVar and the $RoomName are replaced with the actual strings they contain before the if condition is evaluated. |
| Last Updated on Wednesday, 23 June 2010 11:20 |


