Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Mon Mar 29, 2004 10:03 pm   

Expanding Aliases
 
I have an alias that I move another alias into with a parameter and when Zmud goes to send it to my mud, it doesn't get recognized as a command.

I was wonder if anyone has ever ran across this situation.


The situation I have for example would be as follows:

#alias Alias-a {Alias-b 3}

Then in the script @Alias-a is what is expanded with alias-b with parameter 3.

Any ideas?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Mar 29, 2004 10:31 pm   
 
You mean that something like this:
#ALIAS aliasb {#SAY %1}
#ALIAS aliasa {aliasb test}

does not output "test" to the screen?
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Mon Mar 29, 2004 10:57 pm   
 
Yes, that is what I mean. When "aliasb test" without the quotes is being sent to the mud as a command when in actuality, I want #say test to be send as the command.

So, it is as if alias aliasb isn't being expanded.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Mon Mar 29, 2004 10:58 pm   
 
If aliasb is sent without the parameter, zmud expands it fine and the script works. It's the parament that is causing the problem.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Mar 29, 2004 11:10 pm   
 
*Stab in the Dark, Untested and Im porlly way off base*

#ALIAS aliasb {#SAY %-1}
#ALIAS aliasa {aliasb test}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 30, 2004 1:47 am   
 
Sorry, if I'm being repetitive, but try the two aliases I posted in a blank window (hit ESC at the Character Selection) screen. Then, call alias aliasa.

I just want to make sure that we are doing the exact same procedure and getting different results.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Tue Mar 30, 2004 9:36 am   
 
Your example worked, which is perplexing because mine should work also.

Now lets say it didn't work, then Zmud would have "aliasb test" to the mud which isn't want is supposed to happen; instead, "#say test" is supposed to have been sent.

It's as though, Zmud is only expanding on the first alias.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 30, 2004 12:10 pm   
 
Ok, so now that we know my example works, try posting one of yours that fails and the steps you take to get it to fail. Preferably, starting from a blank window. Since besides the obvious reason (aliasb is not defined), I can't see why it would work with mine and not yours.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Tue Mar 30, 2004 4:32 pm   
 
I've left out one small detail which was the definition of a variable. The reason for the variable is in regard to how I'm assigning how the script will work with a #case clause.

#alias aliasa {#say %1}
#variable variable_a {aliasa test}
#alias aliasb {@Variable_a}

When aliasb gets expanded, "aliasa test" isn't expanded to #say test".

Now, if you were to change aliasa details to "#say test" and change variable_a details just to "aliasa", then it expands to return "test" and this is how I have it working now. My recent change to my script was to add the parameter and that is where all my problems started.

Hope that sheds more light onto what I was describing.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 30, 2004 4:41 pm   
 
Heh, well, that little detail is the root of the problem. When zMUD sees the variable reference on its own line, it expands the variable and if it appears to be a command to the MUD (like two separate words) it is sent to the MUD. It does not extra processing on it. If you want the value of the variable to be processed further, you need to use the #EXEC command. Try this:
#ALIAS aliasa {#SAY %1}
#VARIABLE variable_a {aliasa test}
#ALIAS aliasb {#EXEC {@Variable_a}}
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Tue Mar 30, 2004 5:41 pm   
 
Thanks, that did it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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