ID:155100
 
I have a problem with saving overlays, I've tried this:
proc
save()
//
F["overlays"] << src.overlays
load()
var/soverl
F["overlays"] >> soverl
src.overlays += soverl

client
Del()
save()
mob.overlays = null

But that doesn't seem to work.

As for the color wheel, I know how to make it pop up, but how do I apply the color to an overlay?
1. What type of variable is sover1

2. To apply the colour, just define the colour to be an input and add it. Example.

var/X = input() as colour
obj/Y.icon += X
In response to Lugia319
What type of variable is soverl?

Save overlays
In response to Lugia319
Lugia319 wrote:
> var/X = input() as colour
> obj/Y += X
>


how do you do that for overlays?
In response to BeignetLover
Is it a list, a text string, etc...
In response to BeignetLover
Oh I'm sorry. I'll finish explanation. It works like this.

1. I actually apply it to the object's icon var.
2. I add the object as an overlay
In response to Lugia319
I've tried nboth list and text, but neither seem to work

here's the full code:

mob
proc
SaveMob()
fdel("savefile/[usr.ckey].sav")
var/savefile/F=new("savefile/[src.ckey].sav")
src.Write(F)
F["lastx"] << src.x
F["lasty"] << src.y
F["lastz"] << src.z
F["verbs"] << src.verbs
F["overlays"] << src.overlays








Load()

if(fexists("savefile/[usr.ckey].sav"))
var/savefile/F=new("savefile/[src.ckey].sav")
src.Read(F)
var/newX
var/newY
var/newZ
var/savedverbs
var/soverl
F["lastx"] >> newX
F["lasty"] >> newY
F["lastz"] >> newZ
F["verbs"] >> savedverbs
F["overlays"] >> soverl
src.loc=locate(newX,newY,newZ)
src.verbs += savedverbs
src.overlays += soverl
else
src << "Sorry, but you need to create a character in order to play."
del(src)
In response to BeignetLover
What I am going to suggest is this. (Might not be perfect but should work)

1. Save Overlays be a list variable
2. When a person logs out, convert all of their overlays into text strings (If you added using the paths or objs)
3. save these text strings somewhere
4. Login - add overlays back.

In response to Lugia319
mob
proc
SaveMob()
fdel("savefile/[usr.ckey].sav")
var/savefile/F=new("savefile/[src.ckey].sav")
src.Write(F)
F["lastx"] << src.x
F["lasty"] << src.y
F["lastz"] << src.z
F["verbs"] << src.verbs
F["overlays"] << src.overlays








Load()

if(fexists("savefile/[usr.ckey].sav"))
var/savefile/F=new("savefile/[src.ckey].sav")
src.Read(F)
var/newX
var/newY
var/newZ
var/savedverbs = list()
var/soverl
F["lastx"] >> newX
F["lasty"] >> newY
F["lastz"] >> newZ
F["verbs"] >> savedverbs
F["overlays"] >> soverl
src.loc=locate(newX,newY,newZ)
src.verbs += savedverbs
src.overlays += overlaytxt
else
src << "No Save File"
del(src)
Delete()
fdel("savefile/[usr.ckey].sav")
usr << "DELETED"




client
Del()
..()
world << "<i><b>[mob] has logged out!"
mob.AFK = 0
mob.SaveMob()
mob.overlays = null
mob.overlaytxt = mob.overlays
del (mob)

mob/var/overlaytxt


I tried it, when you said "Log in" did you mean when the player logs in? Or on the load proc?
In response to BeignetLover
Do not use usr in procs. Do not call Read() and Write() directly.
In response to BeignetLover
You did not "try it." I'll assume that I was extremely vague and that you did not understand what I mean.

Disclaimer: I'm typing this up at school so I don't have time to debug it, so copy/paste shouldn't be done (might be buggy). But it should at least point you in the right direection.

// First, let's define SaveOverlays

mob
var
list
SaveOverlays = list() // It's an empty list

// Now let's have our default logout/save

mob
SaveMob()
// Yadda Yadda
for(var/obj/X in src.overlays) // Loop through overlays, define them to be X
var/Y = copytext("[src.type]") // Sort of a path2text deal.
src.SaveOverlays += Y // Each Y should be a text string. SAVE THIS VARIABLE, NOT OVERLAYS (Icons are savefile hogs)

LoadMob()
// Yadda Yadda
for(var/A in src.SaveOverlays)
var/obj/B = text2path("[A]") // Convert it back into a path
src.overlays += B // Add the overlay


The only issues that I can see right now, is that the objects won't be in your inventory anymore if they were there to begin with. You can counter this by creating them, adding them to inventory, and adding the variables that say that they are equipped.