Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
vortis
Novice


Joined: 15 Jul 2010
Posts: 39
Location: USA

PostPosted: Thu Jan 20, 2011 9:07 pm   

[3.33a] Simple Question - How to NULL output of a false trigger - RESOLVED
 
So I made a very basic alarm trigger:
%if(@EStaff=0,enchant staff)
%if(@EHauberk=0,enchant hauberk)
%if(@EProtector=0,enchant protector)
%if(@ECoif=0,enchant coif)
%if(@EChausses=0,enchant chausses)
%if(@EMitons=0,enchant mitons)
%if(@ACBless=0,"do 2 bless me,bless me")
%if(@ACBuffer=0,"buffer me")
%if(@ACHaste=0,"haste")
%if(@ACAugment=0,"augment combat")
%if(@ACHoly=0,"holystrike")

The problem is the output on the screen is 1 blank line per command that is a '1' and 1 output command for the ones that are a '0'

So if only some of them are a 0, my output looks like this:
{
enchant staff


enchant coif





haste

holystrike
>
>
>
>
>
>
>
>
}
CMUD is sending a blank line to the MUD for each command that triggers as a '1'. Is there a way to output a trigger that doesn't need anything to be done wo simply do nothing?

I tried: %if(@ACBless=0,"do 2 bless me,bless me","") with the same results. Is there a way for CMUD to simply do nothing if the variable is a "1"?


Last edited by vortis on Fri Jan 21, 2011 3:26 pm; edited 1 time in total
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jan 20, 2011 10:06 pm   
 
Use #IF, not %if(). Functions are not allowed to begin a line.
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jan 21, 2011 2:29 pm   
 
We seem to be getting an awful lot of people making this mistake. A function will execute actions, and will return a value, but is it _not_ a Cmud command statement. A variable contains a value, and can even contain a string which can be interpreted as a command, but it is _not_ itself a Cmud command statement.

Never, ever, ever start a Cmud command line with % or @.

Even if it looks like it works, don't do it.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Jan 21, 2011 3:13 pm   
 
If, for some reason, you do need to simply call a function (and in this case #IF would be better) you would use #CALL <function>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net