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


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Feb 10, 2002 9:48 pm   

Passing values to functions
 
Is there any way to pass a value to a function (aka alias) ?

The only way I can think of is just using 'global variables' like any variable.

And thanks for the help with my other questions Kjata.
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Sun Feb 10, 2002 10:12 pm   
 
Aliases can take parameters and reference them using the %1..%n variables usually available to triggers. For instance:

#alias sayhi {say Hey %1, how ya doin?;smile %1}



zMUD 6 Online Help: All the power you'll ever need.
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Mon Feb 11, 2002 12:02 am   
 
%1...%99 will return the 1-99th argument to the alias. To get all of them from some starting point, use %-1...%-99

#alias say {emote says softly '%-1'}

 - Charbal
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Mon Feb 11, 2002 12:08 am   
 
Oh wow how stupid am I?

heheheheh :P

I've used the %1 and %-1 etc stuff in my script already.. strange thing I didn't think of that :P

Thanks :)
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Mon Feb 11, 2002 12:12 am   
 
Oh and if anyone wanted to know.. I'm making a "Combo Trader" script for Medievia. It'll calculate the combos for items to trade from one place to a destination.
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