ZMud 3.62a Help

by Tavon

Back to Mechanic's Corner.

Tavon2005-01-03 07:10:00
What's wrong with this, and how would I get it working the way I want it to?

#ALIAS ps 'point staff %if(%null(%1)|"%1"="s",@tar %1,%1)'

Basically, if I put in 'ps s', it should return point staff @tar s, which it's not.
Daganev2005-01-03 08:04:29
should it be #IF instead of %if?

and if your syntax is correct I Would suggest the following
#ALIAS ps 'point staff %if("%1"="s",@tar %1,@tar)'
Tavon2005-01-03 08:22:55
See, here's the deal.

#ALIAS ps 'point staff %if(%null(%1),@tar %1,%1 %2)' works perfectly.

What is does is, if I type ps, it sees if I gave it any arguments (ps daganev). If I did, it will point the staff at that argument. If I don't, it will aim at my @tar.

What I want to do is, check to see if I enter a direction (nsew and inbetweens) as the argument. If I do, I want to point staff @tar , rather than point staff . ALso, that didn't work, it returns it as false when using 'ps s'.
Daganev2005-01-03 08:39:25
well I must admit I'm confused. The way I'm reading your alias as as such

#alias ps, If nothing is typed in, do point staff @tar %1, if you do type something in, do point staff (thing you typed in) %2.

Mainly, what you want to do is basically have an IF statment that checks to see if you typed in a direction. If you do, the alias should do Point Staff @tar %1, if you didn't Use your other alias.
Unknown2005-01-03 08:42:06
Never seen zMUD 3.62a script before, but buy looking at that, I'm guessing that you use "'" instead of "{" and "}". So, I would do this:

CODE
#ALIAS ps 'point staff %if( %null( numparam()), @tar, %if( numparam() = 1, %if( %match( "%1", "{s|sw|w|nw|n|ne|e|se|u|d|in|out}"), @tar %1, %1), %1 %2))'


I think that's what you want. You may need to change some of the syntax for 3.62a, but I'm not sure.
Tavon2005-01-03 09:02:26
QUOTE(daganev @ Jan 3 2005, 04:39 AM)
well I must admit I'm confused.  The way I'm reading your alias as as such

#alias ps, If nothing is typed in, do point staff @tar %1, if you do type something in, do point staff (thing you typed in) %2.

Mainly, what you want to do is basically have an IF statment that checks to see if you typed in a direction. If you do, the alias should do Point Staff @tar %1, if you didn't Use your other alias.
24494



Everything you said was exactly correct, and how I meant it to be. I'm just having a problem figuring out how to compare strings. That's all I really want. smile.gif

Zaltan: two problems. #1, I don't have a %match function, and #2, I'm not sure how to compare strings. Otherwise that comes very close to what I want to do. Heh.

EDIT: I think I got it. Very messily. =\\ It works the way I want it to, but there has to be a better way.

EDIT 2: Got it. Completely.
CODE
#ALIAS ps {point staff %if(%null(%1),$tar,%if(%1 =~ "{s|sw|w|nw|n|ne|e|se|in|out|u|d}",$tar %1,%1 %2))}
Unknown2005-01-04 05:11:37
Yeah, =~ is the same as %match.