 |
dr1ddler Newbie
Joined: 18 Jul 2003 Posts: 2 Location: USA
|
Posted: Fri Jul 18, 2003 4:35 am
need help with alias.... |
#ALIAS zombies {#IF {%1 == ""} {#IF {@makezombies} {#UNVAR makezombies;#VAR makezombies FALSE;#WINDOW tell "Zombies: OFF"} {#UNVAR makezombies;#VAR makezombies TRUE;#WINDOW tell "Zombies: ON"}} {#IF {%1 == "on"} {#IF {@makezombies == FALSE} {#UNVAR makezombies;#VAR makezombies TRUE;#WINDOW tell "Zombies: On"}} {#IF {%1 == "off"} {#IF {@makezombies == TRUE} {#UNVAR makezombies;#VAR makezombies FALSE;#WINDOW tell "Zombies: Off"}}}} |
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jul 18, 2003 5:11 am |
I don't think this alias is going to scare any walls, if that was your question. It's the only one I could find.
No mindreaders here. If you want help, please say what the problem is. |
|
|
|
 |
DeathShadow Adept
Joined: 11 Nov 2000 Posts: 228 Location: USA
|
Posted: Sat Jul 19, 2003 7:26 pm |
I read minds!
#alias zombies {#IF (%1) {#VARIABLE makezombies TRUE;#WINDOW tell {Zombies: ON}} {#VARIABLE makezombies FALSE;#WINDOW tell {Zombies: OFF}}} |
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Jul 20, 2003 3:15 am |
Since the forums have been down and you might not have been able to respond, I decided to do my best to guess at the problem. I see Death Shadow beat me to it, but I think he missed part of what you're trying to do (that's what happens when you make people guess).
When I attempted to paste your unedited script into zMUD, it gave {#IF as the response when I tried the alias, and of course the editor showed the expected "syntax error". This is a common error symptom that almost invariably means you didn't match all your {'s with }'s.
Other than that, you have several errors which show you probably learned to write scripts on some other program and didn't think it was worth bothering to see if zMUD's language was different (it is).
The condition statement in an #IF command should be surrounded by parentheses rather than braces
() instead of {}
There is no requirement to double up on equal signs
= instead of ==
Variables can be changed without first removing them
#VAR makezombies FALSE instead of #UNVAR makezombies;#VAR makezombies FALSE
Finally, there's the errors that are probably giving you the most trouble:
A non-existent parameter is NOT identical to an empty string
Boolean values (TRUE/FALSE) are NOT strings ("TRUE"/"FALSE") and can't be stored in variables (which don't have a Boolean type)
#ALIAS zombies {#IF (%numparam() = 0) {#IF (@makezombies) {#VAR makezombies 0;#WINDOW tell "Zombies: OFF"} {#VAR makezombies 1;#WINDOW tell "Zombies: ON"}} {#IF ("%1" = "on") {#VAR makezombies 1;#WINDOW tell "Zombies: On"};#IF ("%1" = "off") {#VAR makezombies 0;#WINDOW tell "Zombies: Off"}}} |
|
|
|
 |
|
|
|