|
Sunioc Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Tue Mar 11, 2008 10:25 am
Need help with an alias |
I need an alias that follows the syntax sap (number of mobs with same name) (name of mob) and returns sap 1.mob;sap 2.mob;sap 3.mob etc, depending on how many mobs there are. How would I go about doing this?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Mar 11, 2008 10:54 am |
When you said return I am assuming you meant for it to be sent to the mud. This actually does a little bit more then you asked for, the usages it supports are:sap, sap target, sap number, sap number target, sap number target number target target etc.
Code: |
#CLASS SapStuff
#VAR SapTarget {} {}
#VAR SapCounter {0} {0}
#ALIAS sap {
#IF (%numparam=0) {
#IF (@SapTarget) {#SEND {sap @SapTarget}}
} {
#IF (%numparam=1) {
#IF (%isnumber(%1)) {
#LOOP %1 {#SEND {%concat("sap ",%i,".",@SapTarget}}
} {
SapTarget=%param(1)
#SEND {sap %1}
}
} {
#CALL %-1 marks all used
SapCounter=0
#LOOP %numparam {
#IF (%isnumber(%param(%i))) {
SapCounter=%i
} {
#IF (@SapCounter) {
#LOOP %param(@SapCounter) {#SEND {%concat("sap ",%j,".",%param(%i))}}
SapTarget=%param(%i)
SapCounter=0
} {
#SEND {sap %param(%i)}
SapTarget=%param(%i)
}
}
}
}
}
#CLASS 0 |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Sunioc Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Tue Mar 11, 2008 1:09 pm |
I tried pasting that in, and the code doesn't work. The script checker shows:
concat("sap ",%i,".",@SapTarget}}
^ syntax error (this is pointing to the second to last }, but the forum won't let me do that apparently.)
and when I save the class, it deletes evertrhing in the alias and leaves me with #ALIAS sap {{#IF} |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Tue Mar 11, 2008 1:45 pm |
Put the script in a text file, save the file, go to the Settings menu in zMUD, select Import, Script (ASCII), and open the file you made. Pasting scripts into the command in zMUD is a bad idea for anything that's even slightly complicated.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Mar 11, 2008 8:50 pm |
I am missing a closing brace on that line. Sorry about that, I am sure you can figure out wher to put it.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Sunioc Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Tue Mar 11, 2008 11:39 pm |
hmm. Fixed the bracket problem, but it still didn't work. I had to write another alias to set the variables, because they wouldn't capture properly. now I can at least get it to do sap (number) (target).
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Mar 12, 2008 2:00 am |
The first time you use it you should be doing a 'sap target', 'sap number target', or even longer form. After that it should work for you to issue just 'sap number' and use the stored target. It doesn't actually store the number ever. Of course I wrote it up on my first cup of coffee this morning, and might have made a few mistakes.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Sunioc Newbie
Joined: 10 Mar 2008 Posts: 5
|
Posted: Wed Mar 12, 2008 5:05 am |
Yeah, it captures numbers, but not the target. That's okay though, I really don't need all the extended functions, so the jury rigged version I've got running now is just fine.
|
|
|
|
|
|