ID:148295
 
I was trying to get overlays to save when you logout, be removed then be put back on but, whenever i login, my overlays dont get put back on.
I would appreciate help on this problem.


mob/var/list/oldoverlays.

PlayersandMonsters
parent_type = /mob/
Login()
usr.overlays += usr.oldoverlays
..()
client
Del()
world << "Removing overs"
usr.oldoverlays+=usr.overlays
usr.overlays=null
Maybe you should do this for the client/Del()...
client
Del()
world << "Removing overs"
usr.mob.oldoverlays = usr.mob.overlays
usr.mob.overlays=null
. = ..()


~~Dragon Lord~~
In response to Unknown Person (#1)
Unknown Person wrote:
Maybe you should do this for the client/Del()...
> client
> Del()
> world << "Removing overs"
> usr.mob.oldoverlays = usr.mob.overlays
> usr.mob.overlays=null
> . = ..()
>


~~Dragon Lord~~

Um, that doesnt work, it gives me un-defined for all the vars there.
In response to Mrhat99au (#2)
Fisrt of all, what is the point of displaying to the whole world that one persons overlays are being removed. Second, (as far as I know), usr is associated with the MOB. Use src instead. Third, here's what I think the code should look like:

client/Del()
src << "Removing your overlays"
for(var/a in mob.overlays) //Don't set the var to the list, but what's IN the list
mob.oldoverlays += a
del(a)
.=..()
In response to Hazman (#3)
Hazman wrote:
Fisrt of all, what is the point of displaying to the whole world that one persons overlays are being removed. Second, (as far as I know), usr is associated with the MOB. Use src instead. Third, here's what I think the code should look like:

client/Del()
> src << "Removing your overlays"
> for(var/a in mob.overlays) //Don't set the var to the list, but what's IN the list
> mob.oldoverlays += a
> del(a)
> .=..()

The only point i had it going to world, is to test if they actually do get removed, and now im getting Type Mismatches. Ill show you my full code, the version i gave you had a bit taken out.

PlayersandMonsters
parent_type = /mob/
Login()
for(var/a in usr.oldoverlays) //Don't set the var to the list, but what's IN the list
usr.overlays += a
..()
realplayer
Login()
return
client/Del()
src << "Removing your overlays"
for(var/a in mob.overlays) //Don't set the var to the list, but what's IN the list
mob.oldoverlays += a//TYPE MISTMATCH
mob.overlays-=mob.overlays
if(istype(usr,/PlayersandMonsters/realplayer))
save()
return
.=..()