|
Podar Newbie
Joined: 17 Aug 2002 Posts: 7 Location: USA
|
Posted: Sat Aug 17, 2002 5:30 pm
#FORALL problem - need help please |
I have a set of aliases, listed below, that work fine except for one. The spglan alias won't process the variable list using the forall command. Can anyone suggest a solution?
#ALIAS spAbort {#T- Spellup;#SA - - - - - SPELLUP ABORTED - - - - -}
#ALIAS SPAdd {#var spTargets {%additem( %proper( %1), @spTargets)}}
#ALIAS SPClear {#var spTargets {}}
#ALIAS SPDel {#var spTargets {%delitem( %proper( %1), @spTargets)}}
#ALIAS SpellPC {#var spTarget {%word( @spTargets, @spTargetNo, "|")};#SA @sptarget;#var spSpell {%word( @spSpells, @spSpellNo, "|")};#SA @spspell;#if %null( @spTarget) {#T- SpellupUp} {c ~'@spSpell~' @spTarget}}
#ALIAS SpellUp {#prompt spSpells "Enter spells using a '|' between each spell. i.e. stone|globe|haste";#T+ SpellUp;#var spSpellNo {1};#var spTargetNo {1};SpellPC}
#ALIAS spglan {#forall @sptargets {glan %1}}
#ALIAS SPlist {#sa Spellup: %replace( @sptargets, "|", " ")}
#ALIAS SPReset {#var spTargetNo {1};#T- SpellUp}
EDIT -- Sorry. I guess I should have been a bit more specific with my problem. In the forall alias, I have tried using both %i and %1 and the alias will spawn the proper number of glan commands but will not add the names in the list. I am at a loss as to what is causing this. I'm using Zmud 6.16 and haven't had any other noticable problems with forall thusfar.
Podar |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Sat Aug 17, 2002 5:58 pm |
You have to use %i, not %1.
Iljhar |
|
|
|
Podar Newbie
Joined: 17 Aug 2002 Posts: 7 Location: USA
|
Posted: Sat Aug 17, 2002 6:01 pm |
quote:
You have to use %i, not %1.
Iljhar
I have tried that and have gotten the same result. the alias will spawn the proper number of glan commands but will not tack on the names in the list. |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Sun Aug 18, 2002 9:43 am |
I just opened an empty character, typed in:
#ALIAS spglan {#forall @sptargets {glan %i}}
Then typed in:
#var sptargets {test|gold|blah|mind|star}
Then typed 'spglan' and received:
glan test
glan gold
glan blah
glan mind
glan star
I don't know what to tell you, it seems to work for me. Maybe someone else will see something.
Iljhar |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Aug 18, 2002 12:48 pm |
Yes, what iljhar says is correct. %i is the one and only correct form. The problem could be that for some reason the @sptargets variable has the correct amount of items in the stringlist, but they are all blank. I tested out your script by entering it all in the command line (replacing %1 for %i, of course), and then did this:
SPAdd Kjata
SPAdd Zugg
SPAdd Podar
SPlist
spglan
the output was:
Spellup: Kjata Zugg Podar
glan Kjata
glan Zugg
glan Podar
Kjata |
|
|
|
Podar Newbie
Joined: 17 Aug 2002 Posts: 7 Location: USA
|
Posted: Sun Aug 18, 2002 4:42 pm |
Thanks for all the help, guys. I after seeing that everyone else had it working, I went in and deleted my original alias completely and made a new one using %i instead of %1 and now it's working. Not sure why it didn't work by just changing the 1 to an i in the original but I guess that's not too important at this point.
Podar |
|
|
|
|
|