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?
ID:169281
![]() Jul 11 2005, 12:05 pm
|
|
mob/verb/test() Why won't that re-add my overlays? |
Try this:
mob/verb/test() Also, if that doesn't work, what isn't working? |
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? |
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.
|
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.
|
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.