Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
CFeather
Newbie


Joined: 29 Dec 2010
Posts: 6

PostPosted: 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.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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. Smile
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
CFeather
Newbie


Joined: 29 Dec 2010
Posts: 6

PostPosted: 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}}
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: 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.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net