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
Kalus
Beginner


Joined: 01 Dec 2000
Posts: 27

PostPosted: Tue Dec 23, 2003 4:01 pm   

alias question
 
I was wondering if there was a way to setup an alias so that if no argument was given, it would use a default variable. For example if i made and alias named bs, to backstab, if i typed bs rabbit it would backstab a rabbit. However if i didn't use an argument like rabbit, it would bs some default target.

I'm assuming the pattern would be something like this

backstab {%1||@defaulttarget}

obviously that doesn't work, but i'm not really sure what to try.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 23, 2003 4:47 pm   
 
#IF %numparam() {backstab %-1} {backstab @defaulttarget}
Reply with quote
Loto
Apprentice


Joined: 05 May 2003
Posts: 194

PostPosted: Tue Dec 23, 2003 7:02 pm   
 
You could also just make two aliases :P

#ALIAS {bs} {backstab <thing you want as default>}
#ALIAS {bs} {backstab %1}
Reply with quote
soldado_del_rey
Newbie


Joined: 23 Dec 2003
Posts: 7
Location: USA

PostPosted: Tue Dec 23, 2003 11:01 pm   
 
quote:
Originally posted by LightBulb

#IF %numparam() {backstab %-1} {backstab @defaulttarget}



But don't IF statements only work when you input them? That's the problem I'm having.
Reply with quote
SolReapr
Beginner


Joined: 03 Sep 2003
Posts: 13
Location: USA

PostPosted: Tue Dec 23, 2003 11:57 pm   
 
Place LightBulb's answer into your alias. As soon as you execute the alias it will parse the #IF statement.
If there are arguments passed then it returns true executing {backstab %-1}
If there are no arguments passed it returns false executing {backstab @defaulttarget}
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