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


Joined: 02 Jul 2004
Posts: 6
Location: Netherlands

PostPosted: Thu Oct 14, 2004 12:15 pm   

How to use a default arguement?
 
I want to do the following thing:
when I cast a shield, I usually cast it on me. For casting the shield, I use an alias called sh.
I want sh to do the following:
sh --> cast shield on me
sh bodyguard 1 --> cast shield on bodyguard 1
Or, of course, on any string I type behind sh.
How can I do this best?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Oct 14, 2004 2:18 pm   
 
#ALIAS sh {cast shield %-1}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
evzwaan
Newbie


Joined: 02 Jul 2004
Posts: 6
Location: Netherlands

PostPosted: Thu Oct 14, 2004 2:52 pm   
 
Hm, I fail to see how that would put cast shield on me to the mud when I type just sh.

I've now solved my problem using a help variable, an if statement and the %len function, so I'm happy now.
For anyone who's interested:

#var target {%-1}
if (%len(@target)=0) {#var target me}
cast shield on @target
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Thu Oct 14, 2004 4:02 pm   
 
#alias sh {cast shield on %if(%1="","me",%-1)}
Reply with quote
evzwaan
Newbie


Joined: 02 Jul 2004
Posts: 6
Location: Netherlands

PostPosted: Thu Oct 14, 2004 5:25 pm   
 
Much better, thanks.
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