ID:169281
 
mob/verb/test()
var/list/myoverlays = list()
for(var/O in usr.overlays)
myoverlays += O
myoverlays = usr.overlays
usr.overlays = 0
sleep(5)
for(var/O in myoverlays)
usr.overlays += O


Why won't that re-add my overlays?
From the Refernce Entry for 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.

In other words, a for(blah in overlays) loop won't work; I don't think a direct assignment (var/blah = overlays) works either, but it might.

The one what that I know works is to keep the list as a mob var, and change it wherever you change overlays, you can then use that list to "restore" the overlays later.
Try this:

mob/verb/test()
var/list/myoverlays = list()
for(var/obj/O in usr.overlays)
myoverlays += O
//myoverlays = usr.overlays // I don't know why you would have this.
usr.overlays = null
sleep(20) // Maybe you should wait a bit longer, 5 ticks is kinda fast
for(var/obj/O in myoverlays)
usr.overlays += O


Also, if that doesn't work, what isn't working?
In response to Destroy
Destroy wrote:

In other words, a for(blah in overlays) loop won't work; I don't think a direct assignment (var/blah = overlays) works either, but it might.


I have used a for loop for overlays. Are you sure this doesn't work?
In response to N1ghtW1ng
I've tried to do the same thing he is before, and I'm pretty sure that using a for() loop in overlays didn't work, at least not for that purpose.
In response to Destroy
I used it for that exact purpose, well not exactly I used it because saving overlays didn't work so well for me. I think it was Lummox who told me to do that, i'm going to find my example which worked occasionally.
In response to Destroy
Try using the Copy() procedure instead.