About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
ecourt
Apprentice


Joined: 29 Dec 2000
Posts: 146
Location: USA

PostPosted: Thu Jan 13, 2011 1:11 am   

alias stored in a variable, wont expand and trigger (3.33a)
 
I see cmud send the lines to the mudd, but it don't parse them as aliases.
Zmud parses these fine.
I tried adding #exec, and %execute on the @kcmd variable, but it still just sends the text to the mudd, without parsing it.
the @dirr part works just fine.

nn bb vv mm are all aliases for spells
#dirr is a direction (n s e w)

pretty simple few lines of code...
Code:

#var kcmd %case( %random( 1, 4),nn,bb,vv,mm)
#if (%item( @bugs, 1) == "") {@dirr} {@kcmd" "%item( @bugs, 1)}
Reply with quote
ecourt
Apprentice


Joined: 29 Dec 2000
Posts: 146
Location: USA

PostPosted: Thu Jan 13, 2011 1:29 am   
 
hummm, 2nd time I tried the exec, it worked..
Code:

#var kcmd %case( %random( 1, 4),nn,bb,vv,mm)
#if (%item( @bugs, 1) == "") {@dirr} {%exec(@kcmd)" "%item( @bugs, 1)}
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Jan 13, 2011 5:36 pm   
 
In CMUD, a line cannot start with a variable or function reference (because many MUDs use commands that start with @ at the beginning of the line for various chatting).

So yes, #EXEC is what you should be using. The correct syntax for what you are doing is:
Code:
#if (%item( @bugs, 1) == "") {#EXEC @dirr} {#EXEC %concat(@kcmd," ",%item( @bugs, 1))}

Remember that #Commands perform an action (such as executing code with #EXEC), whereas %functions return a value. So you should be using #EXEC and not %exec.
Reply with quote
ecourt
Apprentice


Joined: 29 Dec 2000
Posts: 146
Location: USA

PostPosted: Thu Jan 13, 2011 5:43 pm   
 
oddly enough, the {@dirr} works fine...
always had trouble figuring out the difference between % AND # commands, thanks for the clarification
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Fri Jan 14, 2011 5:26 pm   
 
Quote:
oddly enough, the {@dirr} works fine...

As in zMUD, this is accidental and not by design and you should not depend upon that continuing to work.
Reply with quote
ecourt
Apprentice


Joined: 29 Dec 2000
Posts: 146
Location: USA

PostPosted: Fri Jan 14, 2011 6:15 pm   
 
nope, it works in cmud 3.33a, but I have since changed it.
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