|
Avangard Newbie
Joined: 23 Aug 2004 Posts: 5
|
Posted: Mon Aug 23, 2004 3:55 am
alias #while loop problem |
here is what i'm trying to do
i want an alias called spf
you should be able to type something like this spf -name blah -level 4 34
etc etc, and there can be a variable number of those
i want an alias that will take all the stuff that comes after spf and store it all
in a variable as a list, with each thing being on a seprate line (ie {-name|blah|-level|4|34}
i'm hardly an expert but here is what i have so far
the first 2 lines are to clear the variable that stores my flags before each use
then i tried to make a while loop for it to test %1 wheter it's empty or not,
then test %2 and so forth untill it finds one that has nothing in it
#UNVAR @Flag
#VAR Flag %null [""] [{Scripts|SpellFilter}]
#VAR FlagCounter 1
#VAR FlagTest %@FlagCounter
#WHILE {%exec( @FlagTest)!=""} {
#VAR Flag %additem( {%exec( @FlagTest)}, @Flag)
#MATH FlagCounter @FlagCounter+1
#VAR FlagTest %@FlagCounter |
|
|
|
Avangard Newbie
Joined: 23 Aug 2004 Posts: 5
|
Posted: Mon Aug 23, 2004 5:04 am |
i changed my alias to this
#UNVAR @Flag
#VAR Flag %null [""] [{Scripts|SpellFilter}]
#VAR FlagNumber %numParam( ) [""] [{Scripts|SpellFilter}]
#WHILE {@FlagNumber!=0} {
#VAR Flag %additem( %param( @FlagNumber), @Flag)
#MATH FlagNumber @FlagNumber-1
#SHOW DebugMsg
#WAIT 1000
#BREAK
}
works ok, except it only stores the last value
ie if i did spf 1 2 3 4 5, the value in Flag would be 5|||||
i think this is a better way of doing it only if it would store all the stuff i want |
|
|
|
Avangard Newbie
Joined: 23 Aug 2004 Posts: 5
|
Posted: Mon Aug 23, 2004 5:12 am |
nevermind, added #NOOP i fixed it
#UNVAR @Flag
#VAR Flag %null [""] [{Scripts|SpellFilter}]
#VAR FlagNumber %numParam( ) [""] [{Scripts|SpellFilter}]
#WHILE {@FlagNumber!=0} {
#VAR Flag %additem( %param( @FlagNumber), @Flag)
#NOOP
#MATH FlagNumber @FlagNumber-1
} |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Aug 23, 2004 10:18 am |
#VAR Flag {}
#LOOP %numparam {
#VAR Flag {%additem(%param(%i),@Flag)}
} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Avangard Newbie
Joined: 23 Aug 2004 Posts: 5
|
Posted: Tue Aug 24, 2004 1:30 am |
thx, that's alot neater then what i came up with
|
|
|
|
|
|