ID:176721
 
Hey i was working on some code, then when i was making a code to detect something in the overlays, a simple if along this line:

if(src in usr.overlays)
blablabla
Now doesnt that seem like it would work, it should. I use an almost identecal code to check to see if something is in the users contents, and it works. So why wont this? It always proves 0 never 1.
src in usr overlays? im not sure what your trying to do.
maybe you want this
if(usr.overlays == "blahblahblah")
whatever you want to happen :)
In response to Metallica
well the problem with that is that if it == than it cant contain anything else can it? src in usr.overlays would make sence, because the overlays are a list, and src in usr.list would check to see if src would be in usr's list. It makes sence. You way would limit me to just having that object in the overlays and i have lots of items in the overlays.
Do you add <font color=yellow>NEW</font> objects?
If not this may be a reason (I can't back it up but it couldn't hurt)

Like this I believe,

var/obj/O
O=new /obj/shirt
usr.overlays.Add(O)

Im guessing that if it isnt being read, it is called instead of listed (I can't see how the overlays list is defined so I'm just guessing).

If that doesnt work you could possibly cheat the system.

mob/var/OtherOverlays
mob/Login()
OtherOverlays=new list()

new list() may be one word, im still learning... heh

Try this after

var/obj/O
O=new /obj/shirt
usr.overlays.Add(O)
usr.OtherOverlays.Add(O)

Then to look for something.

for(src in usr.OtherOverlays)
//Whatever you wish here


And if none of this works than I apologize, but I am trying to help as I am learning.

James B.
...The Guardian of Dragons...
In response to Dragon Guardian
Sorry it didnt help, i know the obj's exsist, i can see them on the char. The for var wont help, well it would but it would be that long way around. I could also make a list that is always equal to the overlays list, but im not sure if it would work or not, can someone try to test an overlay system like i have. It goes from the contents to the overlays(and stays in the contents) and then i check to see if its there, would someone check this out for me. Im sure everything im doing is right, unless it has to do with being in both contents and overlays at the same time, but im pretty sure it doesnt.
from http://www.byond.com/docs/ref/info.html#/atom/var/overlays
"The individual items in the list may not be directly accessed, since they are stored in a special internal format. However, the list operators +=, -=, and the procedures Add, Remove, and Cut work normally."

You'll have to work out another method. Perhaps a redundant list?
In response to Shadowdarke
Darn it, it really ought to be treated like anyother list. But thanks, i guess i will have a dumbie list thats exsactly the same all the time.
In response to Scoobert
Whats a good way of making another var always equal overlays?

[edit]
LOL i overlooked the easyest way, make a var called wear, and when the item is put on the overlay, it makes wear =1 and when it checks to remove, it checks for that one, not the most acurate way, but as long as i do it right, i should have no problems.