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


Joined: 28 Nov 2011
Posts: 5

PostPosted: Sat Dec 31, 2011 3:25 am   

Capturing messages into Variables... how?
 
I can capture single words into a variable using %1, how can I get a whole input?

Desired...
>Input:
lsay1 Hello there. My name is Mike.
>Output:
lsay spanish Hello there. My name is Mike.

Any suggestions?
Reply with quote
shalimar
GURU


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

PostPosted: Sat Dec 31, 2011 3:49 am   
 
the correct way to capture a portion of your pattern into a variable is to enclose it in parenthesis, then reference it with %1 %2 etc

assuming you are using %1 in a alias, %0 or %-1 would be the entire list of arguments
_________________
Discord: Shalimarwildcat
Reply with quote
angelwingfields
Newbie


Joined: 02 Jan 2012
Posts: 1

PostPosted: Mon Jan 02, 2012 12:57 am   
 
Can somebody explain this further? Thanks!
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jan 02, 2012 3:09 am   
 
I think you need to explain exactly what you are wanting CMUD to do a bit better. From the information you have provided I can only assume you mean an alias, such as this one:

#ALIAS lsay1 {lsay spanish %params}

This will take anything typed after the user defined command 'lsay1' and append it to 'lsay spanish' command instead
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Jan 03, 2012 2:02 pm   
 
In explanation--%1 only grabs the first parameter (i.e. word) after the alias. %2 would grab the second word, etc. To grab all the words, use %params instead of %1. %0 is an old Zmud alternative to %params, which is retained for compatibility reasons.
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