Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
geosmith
Wanderer


Joined: 23 Apr 2005
Posts: 57

PostPosted: Sat Dec 16, 2006 10:41 pm   

CMUD alias question
 
I'm trying to convert from zMUD to CMUD, but I'm a little confused about the following...

In zMUD, if I created an alias "fl", with this value:

#VAR target %1
cast firelash at @target


... then I could, for example, "fl orc", which would cast the spell at the orc, or subsequently just use "fl" on its own, which would continue casting at the last value assigned to "target" until a new one was set.

However in CMUD, it seems to be the case that the same alias will, when used on its own, set the target variable back to blank. Is there any way to create an alias which will only change the value of a variable when followed by another word?
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Dec 16, 2006 10:55 pm   
 
#ALIAS fl {
#if (%1) {#VAR target %1}
cast firelash at @target
}
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Dec 17, 2006 1:04 am   
 
Oho! This is definitely good to know, as in ZMud the #IF condition would have broke if you weren't passing a parameter (null does not equate to false). Now I won't have to test for null all the time.
_________________
EDIT: I didn't like my old signature
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Sun Dec 17, 2006 1:18 am   
 
So whats with %null then?

#IF (%null(%1)) {}
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sun Dec 17, 2006 10:11 am   
 
Mine was probably lazy. If he's gonna attack something called 0 or FALSE then my example would go odd. Caled's is probably more correct
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: Sun Dec 24, 2006 2:39 am   
 
i always used %len(%1) in zmud cos it was an easy way to check, and later you could make it do even more detailed checks like, %len(%1)>3 and stuff incase you wanted minimum of x chars input
_________________
The Drake Forestseer
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Dec 24, 2006 2:53 am   
 
There will always be uses for %null because 0 and "" are both false but only 1 is null just a crude example, The change with cmud just makes it so you don't always have to explicity call %null all the time
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Dec 24, 2006 4:31 pm   
 
You can also use %numparam. So:

#if (%numparam()>0) {#var target %1}
cast firelash at @target

Yes, you need the brackets.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Ggoss
Apprentice


Joined: 01 Nov 2006
Posts: 114

PostPosted: Wed Jan 03, 2007 2:27 am   
 
alias: FL
value: cast firelash at @{tartemp1} %param(0)

using this will allow you to either set target or if you type fl name it will cast on that instead. Now you will still need to setup target variable, you can use something like

alias:tar
value: #var tartemp1 %1 or change to target if you want, your choice
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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