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
Leyline
Wanderer


Joined: 03 Feb 2007
Posts: 64

PostPosted: Thu Jan 17, 2008 3:47 am   

%0 vs. %-1, also {someAlias %0}, drop unwanted parameters from alias usage.
 
Thanks in advance!

1st question
I had some old alias' from like 1992,
and I had used %0 alot to mean everything (parameter) after an alias

I now see most scripts using %-1
and I read %-1 is The first, and every following parameter, %-2 is the 2nd and all parameters... so on and so on.

Is there still a place for %0, is it backwards compatibility, should I start using %-1 and convert all my old %0's?

2nd question.
I had some alias set like
#alias {somealias %0} {#exec say @0}
is that like a tintin convert remenant from my solaris days at teh university, and I should dump the %0 after the alias and remove the @0?

3rd question
What is the respectable way to make an alias not append any parameters or extra text to it's last command?
make a silly if to use %0, but then not output it anywhere (or %-1 based on the answer to question 1?)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Jan 17, 2008 4:03 am   
 
%0 only works for compatability. Use %-1 from now on.

Your second example in invalid. Parameters are automatically put into the %nn and %-nn variables. You also only need #exec when you're trying to evaluate something before you send it to the MUD (for example, "send the contents of @Command to the MUD" would be "#exec @Command"). I believe this does the same thing:

#alias somealias {say %-1}

Your third example, if your alias may have unused parameters, add a #noop command to the end. Better would be simply to make sure you use all the parameters your alias receives, though.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Leyline
Wanderer


Joined: 03 Feb 2007
Posts: 64

PostPosted: Thu Jan 17, 2008 4:51 am   
 
Thanks Fang )
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