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
xongus
Beginner


Joined: 01 May 2011
Posts: 12

PostPosted: Mon May 02, 2011 5:53 am   

Saving an alias to a variable then executing the alias in the variable
 
Before I had a modular system that would allow for the use of different aliases within the system to run different modules with a main. For example:

Code:

#ALIAS setType {#RESET %1|counter; type = %2}


This alias would reset a counter folder and then assign %2 to the variable named 'type'.

I would then in following triggers do something like this:
Code:

#TR {^Here you see a (%1)} {@type %1}


This does not work in cmud as it does not treat @type as an alias but rather a string now. I tried %alias(), but that gives me the name and does not actually execute the alias. I'm sure I'm missing something basic that's just different than how zmud is.

Summary: I want to save the name of an alias in a variable then later call the variable which in turn executes the alias with parameters following it.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon May 02, 2011 8:29 am   
 
You'll need to use the #EXEC function now. In zMUD, you were able to start a line with a function or variable (such as your example). With the changes (you can find them under the documentation), it is required to preface each line with a command, alias, or MUD command.
Reply with quote
xongus
Beginner


Joined: 01 May 2011
Posts: 12

PostPosted: Mon May 02, 2011 2:02 pm   
 
[quote="charneus"]You'll need to use the #EXEC function now. In zMUD, you were able to start a line with a function or variable (such as your example). With the changes (you can find them under the documentation), it is required to preface each line with a command, alias, or MUD command.[/quote]

Ah, I read that but didn't realize it affected variable evaluation that way. Thanks, that works perfectly.
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