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
Moonflight
Newbie


Joined: 06 Apr 2009
Posts: 4

PostPosted: Fri Jan 15, 2010 2:42 pm   

ZMUD settings that just won't work in CMUD
 
Hi all,

I'm told these settings work fine in Zmud, but for some reason, Cmud doesn't like the wildcard on the end of the variable - keeps flagging it as an error. If anyone could tell me why, or if there's a work-around, that would be great.

#alias {BP} {outp @poison%1;blowpipe @poison%1 @targ;inp @poison%1}

#VAR POISONN {NANN}
#VAR POISONG {GRIMLEAF}

(We've tried using poison*, poison%1 and poison%w, but Cmud doesn't like any of them...)

Thanks in advance
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jan 15, 2010 4:01 pm   
 
The reason why is that you are depending on "implicit concatenation", assuming that the variables will expand and automatically attach to the adjacent words. Many times this will work fine, but there are cases where there is ambiguity. One example is "@poison%1". This could be interpreted two ways: as the variable "poison%1" or as the variable "poison" concatenated with the value %1. Zmud simply assumed the second case. Cmud needs to be much more stringent, and doesn't try to guess which you mean--it flags it as an error.

The solution is to use explicit concatenation, such as:
Code:

#alias {BP} {$poisonname = %concat(@poison,%1);outp $poisonname;blowpipe $poisonname @targ;inp $poisonname}
Reply with quote
Moonflight
Newbie


Joined: 06 Apr 2009
Posts: 4

PostPosted: Sat Jan 16, 2010 1:51 am   
 
Thanks for the reply, Rahab. Copied the new alias over, but I'm still getting an error flag on the @poison. Double checked, and I don't have one variable called '@poison', all of them have names like @poisonn, etc. Any more ideas?
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sat Jan 16, 2010 1:44 pm   
 
Try this

Code:
#alias {BP} {$poisonname = %concat("@poison",%1);outp @{$poisonname};blowpipe @{$poisonname} @targ;inp @{$poisonname}}


Rahab's was trying to expand @poison, which isn't what you wanted. You wanted the letter appended to @poison (so that it would become for example @poisonn. Secondly, it would still require you to reference a global variable using the concatenated string, which the @{@xxx} does. So, with this, you get outp NANN when you do BP n
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Sat Jan 16, 2010 2:16 pm   
 
This is easily fixed by using extra brackets around the intended variable name:
Code:
#alias {BP} {outp @{poison%1};blowpipe @{poison%1} @targ;inp @{poison%1}}
Reply with quote
Moonflight
Newbie


Joined: 06 Apr 2009
Posts: 4

PostPosted: Sat Jan 16, 2010 7:25 pm   
 
Many thanks, Dumas and gamma_ray - both of those work, but for simplicity, gamma_ray gets the cookie Smile
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