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


Joined: 13 Dec 2011
Posts: 3

PostPosted: Tue Dec 13, 2011 4:18 pm   

How do I get something I type in the command line as a variable in an alias?
 
Sorry if this is on the forum or holp somewhere. I don't have any programming experience with this and can't work out how to do it.

In short, I'm trying to save myself lots of typing similar instructions by creating an alias and using the text from the input line as a variable but can't see how to do it.

As an example, t would be something like turning:

"Get xxx from backpack"

into

"Getbg xxx" where xxx = whatever it is I want to get out of the backpack. Obviously Getbag is the rest of the intstruction.

I've read throiugh the manual/instructions/forum but can't see how to do it.

Thanks in anticipation

Frank
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 13, 2011 5:16 pm   
 
Type this in at the command line; it will create an alias to do what you want:
Code:

#ALIAS getbg {#SEND Get %1 from backpack}

Basically, all aliases are presumed to have parameters, separated by spaces. You can use these parameters inside your alias code as %1, %2, etc., or %params for all of them. You don't need to do anything special.

Once you create the alias, you should be able to type "getbg xxx" to get xxx from your pack.
Reply with quote
harleyfrank
Newbie


Joined: 13 Dec 2011
Posts: 3

PostPosted: Tue Dec 13, 2011 7:52 pm   
 
Thanks
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