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
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Tue Dec 04, 2007 11:57 pm   

[2.14a] Question about CMUD Argument passing
 
I used to use quotes to group arguments with white space that needed to be passed to other aliases. In CMUD it doesn't evaluate them in quotes. Is there a way to group the arguments together (which contain white space) so that they are passed as one argument containing white space?

An example is shown below where I pass FirstArgument as the first argument and "Second: %1" as the second. Is there a way to group it together but to have it evaluate the %1 so it passes it correctly?

<class name="test" id="9">
<alias name="fun" id="10">
<value>fun2 FirstArgument SecondArgument %1</value>
</alias>
<alias name="fun2" id="11">
<value>#say First: %1 ---- "Second: %2"</value>
</alias>
</class>

Result:
========================
Execute:
fun hello

Result:
First: FirstArgument ---- Second: %2
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Wed Dec 05, 2007 1:21 am   
 
Found the answer, brackets {} are the way to do this. Groups text with white space but allows %1 to be substituted.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Dec 05, 2007 12:14 pm   
 
You could also concatenate the string, like so:

Code:
<class name="test" id="1">
  <alias name="fun" id="2">
    <value>fun2 FirstArgument "SecondArgument "%1</value>
  </alias>
  <alias name="fun2" id="3">
    <value>#say First: %1 ---- Second: %2</value>
  </alias>
</class>
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Wed Dec 05, 2007 9:53 pm   
 
Yep, another good way of doing it, thanks Larkin.
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