ID:155576
 
Hello. I'm trying to get some experience in coding, but I got an question again. In short, I need to know how to make for() check if certain objects are in one list, but not in another. I tried to do it with if(), but debug showed it makes infinitive loop because mob checks save object over and over, so I try to make it add invalid objects to certain list and then skip those objects. If you need code, please ask.
mob/var/list/Items=list("Name Here","Name There","Name Where","Name Who")//List
mob
verb
Check_Item()// verb for Checking
var/Found=0//temp var for checking whether found or not
for(var/I in src.Items)//for proc
if(I=="Name Here")//Checking If there is one with same name
Found=1//If yes then make Found var to 1
if(Found)//Check wheter it is true
usr<<"Yay Its working Fine"//If yes then tell user it is there
else//Other wise
usr<<"Oh no Its not there"//tell user that its not found

In response to Hassanjalil
Hassanjalil, that is a very bad way of doing things. Might I suggest you brush up your skills some before attempting to help others? (Not trying to be mean about it.)

And to answer your question Marty:
var
a[]=list("Cats","Dogs","Mice")
b[]=list("cats","Cats")
mob/verb/check()
for(var/c in (a&b))//This finds out if they are in both lists in a neat little compact way.
src<<c


EDIT: I misread what you asked for, here. (Added a note to the earlier loop)

mob/verb/check()
for(var/c in a)//All elements in list a, get assigned to c after each goes through the following:
if(!(c in b))//if c is not in b
src<<c//display it.