|
evzwaan Newbie
Joined: 02 Jul 2004 Posts: 6 Location: Netherlands
|
Posted: 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? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Oct 14, 2004 2:18 pm |
#ALIAS sh {cast shield %-1}
|
|
|
|
evzwaan Newbie
Joined: 02 Jul 2004 Posts: 6 Location: Netherlands
|
Posted: 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 |
|
|
|
Theragil Apprentice
Joined: 13 Feb 2004 Posts: 157 Location: USA
|
Posted: Thu Oct 14, 2004 4:02 pm |
#alias sh {cast shield on %if(%1="","me",%-1)}
|
|
|
|
evzwaan Newbie
Joined: 02 Jul 2004 Posts: 6 Location: Netherlands
|
Posted: Thu Oct 14, 2004 5:25 pm |
Much better, thanks.
|
|
|
|
|
|