|
Schatten Newbie
Joined: 22 Nov 2001 Posts: 4
|
Posted: Thu Nov 22, 2001 7:55 pm
A simple scripting question. |
I want to ECHO some text back to the client as part of an alias, but I don't know how to do it.
Here's the alias:
%if( @BP > %round( %eval( %db( @SpellCosts, %1) * 1.5)), cast %1 %2, %if( @Fighting=1, feed, ""))
Now, where those double quotes are at the end of the last if I want to do the following:
#ECHO You do not have enough blood to safely cast this spell. It requires %db( @SpellCosts, %1) at a minimum, and you must have at least %round( %eval( %db( @SpellCosts, %1) * 1.5)) to SmartCast it.
You cannot, however, simply drop this text into the if, it gives me a syntaxt error to try to use a # command of any kind there.
How do I do this? |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Thu Nov 22, 2001 11:28 pm |
You could put the #ECHO part in another alias and call that alias in the %if.
Or you could replace the %if with an #IF function, that way you don't need the extra alias:
#IF ( @BP > %round( %eval( %db( @SpellCosts, %1) * 1.5))) {cast %1 %2} {#IF ( @Fighting=1) {feed} {#ECHO You do not have enough blood to safely cast this spell. It requires %db( @SpellCosts, %1) at a minimum, and you must have at least %round( %eval( %db( @SpellCosts, %1) * 1.5)) to SmartCast it.}}
Acaila |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Nov 24, 2001 2:02 am |
As with everything else in Zmud there are at least three ways to do something. Replacing the function if with the command if is the best as Acaila suggested. An alias is the next best, and the last way would be to preceed your if function with the EXEC command.
In general you should only use the if function inside user-defined functions, all other places should be the if command. Just a general rule though. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|