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

Joined: 31 Jul 2002
Posts: 3
Location: USA

PostPosted: Tue Mar 09, 2021 7:26 pm   

Sending commands to mud via captured arguments
Hi all,

I'm just now moving from zmud to cmud. After porting over my settings, I'm finding that I have to tweak a particular scenario which makes me think I'm doing something wrong. I've scoured the docs and can't see anything explaining why this isn't working, so I thought I'd ask here and see if you can set me straight.

I have a trigger:


Pattern: ~[Exits: (%w) (%w)~]
Tigger: #if %ismember(@fromdir,%1|) {x%2} {x%1}

If the command triggers on


The Hall of the Castle of Frontenac (*)
[Exits: north east]

and @fromdir is north, then I want the result to be a command "xeast", which is another alias I have defined. The result I actually get is "x east" sent to the mud. So in this case the %1 is expanding properly but there is a space being inserted where it shouldn't be. I tried using %concat(x,%1) and while it did result in "xeast", that resulting command wasn't parsed(it's another alias I have defined) so "xeast" was sent to the mud itself. IOTW here I have two problems, x%1 is inserting a space where it shouldn't, and the results of %concat(x,%1) aren't being interpreted as an alias appropriately. What DOES work is using #EXEC:


#if %ismember(@fromdir,%1|) {#EXECUTE x%2} {#EXECUTE x%1}

Another example is an alias:


Name:   alt
Code:   :@altvar:%0

This simply takes whatever I put after alt and sends it to another window whose name is what's in @altvar. In this case, the alias DOES send the alias's argument to the desired window, but as in the first example, if that argument is an alias itself, that alias is NOT being interpreted as such in the other window. Again, here, #exec works as expected:

:@altvar:#exec {%0}

So, while I've found a workaround, the thought of going through all of my scripts to adjust for adding #exec isn't exciting and I'm sure something will be missed. And since this wasn't mentioned in the zmud upgrade FAQ, I feel like I'm missing something. Can anyone tell me why I'm experiencing this and if there's something more elegant and hopefully easier I can do to address?

Reply with quote

Joined: 04 Aug 2002
Posts: 4348
Location: Pensacola, FL, USA

PostPosted: Sun Mar 14, 2021 2:24 pm   
This is expected behavior.

You could also use:
#EXECWIN windowName {alias}

zMUD tended to assume what you wanted to happen more than CMUD does.
Which led to some bad habits its users need to break out of.
Like this one you found with implicit concatenation.
CMUD expects you to be a lot more precise.

In that same vein, you should get in the habit of wrapping #IF expressions in parenthesis.

#IF (%ismember(@fromdir,%1|)) {dostuff}
Discord: Shalimar#3679
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