|
geosmith Wanderer
Joined: 23 Apr 2005 Posts: 57
|
Posted: 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? |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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... ;) |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Sun Dec 17, 2006 1:18 am |
So whats with %null then?
#IF (%null(%1)) {} |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: 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... ;) |
|
|
|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: 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 |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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. |
|
|
|
Ggoss Apprentice
Joined: 01 Nov 2006 Posts: 114
|
Posted: 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 |
|
|
|
|
|