|
CFeather Newbie
Joined: 29 Dec 2010 Posts: 6
|
Posted: Fri Mar 04, 2011 4:12 pm
Multiple String List to Sort |
I have 2 lists I wish to sort in order to set a variable.
The first string list is @curselist
The second string list is @afflictionlist
I want to check in order each item from @curselist and see if its on @afflictionlist. If it isnt on the list I want to set the variable @nextcurse. Once the variable has been set I want to stop the sort.
This is beyond my low level cmud competance. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Mar 04, 2011 7:10 pm |
Code: |
#FORALL @curselist {
#IF (%ismember( %i, @afflictionlist)) {
#VAR nextcurse %i
#BREAK
}
}
|
Normally I'd try to explain all of it, but I have to run off to work. If no one has explained it when I get back, I will, so that you can, hopefully, begin to learn how to solve your problems in the future and maybe even help others. |
|
|
|
CFeather Newbie
Joined: 29 Dec 2010 Posts: 6
|
Posted: Fri Mar 04, 2011 7:43 pm |
Thanks. Ive used Forall and %ismember statements before but never combined them and didnt know how to incorporate #break. I changed it a bit but I might not have explained myself fully.
#FORALL @curselist {#IF (%ismember( %i, @afflictionlist)) {} {#VAR nextcurse %i;#BREAK}} |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Mar 05, 2011 3:03 am |
Code: |
#FORALL @curselist {#IF (!%ismember( %i, @afflictionlist)) {#VAR nextcurse %i;#BREAK}}
|
That will do what you want then. I probably read it wrong as I was in a rush. |
|
|
|
|
|