ID:1881607
 
(See the best response by Lummox JR.)
My players randomly get their save files deleted and then a .sav.lk file pops up in the save folder with their key. Can anyone tell me what this is?
Best response
The .lk file is a lock file created by Dream Daemon to avoid other processes (or itself, in some cases) messing with the savefile.
In response to Lummox JR
How do I disable that lock? or is there no way?
The lock is there for a reason; but if the files don't exist anymore, you can just delete it.

The random deletion issue you mentioned is the bigger deal. The lock should not be causing that, but is probably left over as a side effect.
In response to Lummox JR
Their save files don't necessarily get deleted, rather whenever they log on, the lock file appears and they start off wiped when their save files still in tact in the folder that it's located it.
Are you seeing any runtime errors that say anything about failure to load the file?
In response to Lummox JR
Not in particular..
Humm it would be better if you showed us your Load and Save procs/verbs
mob/proc
Save()
var/savefile/F=new("players/[src.key].sav")
Write(F)
Load()
if(fexists("players/[src.key].sav"))
var/savefile/F=new("players/[src.key].sav")
Read(F)
Hummm those procs look ok to me... What about the write and read proc? Do they look like this?

    Write(var/savefile/f)
f<<stuff


Read(var/savefile/f)
f>>stuff
In response to Misticone
Mmm, I used the built in write and read proc
So you didn't write any reference to the Write or Read proc?

The Write proc will determine what is supposed to be sent and stored in the savefile and the read proc will get the data from the savefile, for example:

mob
var/stuff = 0 //This is the var that we are going to use to study the save system

mob/proc
Save() //This will call the write function
var/savefile/F=new("players/[src.key].sav")
Write(F)
Load() //This will call the Read function
if(fexists("players/[src.key].sav"))
var/savefile/F=new("players/[src.key].sav")
Read(F)
world<<stuff

mob
Write(var/savefile/f) //What will be stored in the savefile:
f<<stuff //The stuff variable
Read(var/savefile/f) //What will be extracted from the savefile:
f>>stuff //The stuff variable



mob/verb //Play around with this verbs
Save_()
Save()
Load_()
Load()
ChangeStuff()
var/i = input("number") as num
stuff = i
world<<stuff
In response to Misticone
Yeah, I know what the read and write procs do, but when I didn't define it, it still just saved every variable by itself, so I thought it was good. Every once in a while, a player's save file just randomly loses all its saved variables and the .lk extension file pops up out of nowhere.
Hummm yeah, you're correct...I was just hoping that it could fix your problem...it's weird.... Show me how are you calling the Save and Load procs.
In response to Misticone
Whenever you log in, it loads. Whenever you logout it saves. Whenever you kill someone/die, it also saves.(It's an arena game.)

ex)
mob/Login()
src.Load()
Hummm this is really weird. Humm ok, you said that players lose data, right? When does that happen? When the player logs in? during gameplay? Randomly?
In response to Misticone
The player instantly logs off and back on, I can tell cause it appears in the chat, then their entire save file just disappears out of random, while the .sav file is still intact with their variables saved and in check. Sometimes restarting the server rolls their save back and it's alright, but most of the time that won't fix the issue. Also, sometimes when their .sav file that got wipe is still in the folder, they can't load anything like, playing a new save and relogging won't load up that save.
I think I know what's happening: You're experiencing the dreaded rollback.

Somewhere you've allowed mobs to accidentally save each other in their savefiles. This happens most often when you use a var like a turf, and don't mark it as tmp:

mob/var/turf/badidea          // anything on this turf will be saved
mob/var/tmp/turf/goodidea // this will not be saved

When a player logs in who has someone else in their savefile, that older version of the other player's mob loads up. Because it has a key var, it takes control of their client--they log out of their current mob, and log into their past self.

If you want to avoid a pwipe, you'll have to either find all the savefiles that have this and edit the extra mobs out manually, or you'll have to alter mob/Read() to scrub the offending vars before they load. (In any case you need to make sure the offending vars become tmp so they stop saving.)
In response to Lummox JR
Pwiped, made deathcheck save both the killer and the person killed.
I'm confused as to why you would've needed to hang on to that information after the deathcheck proc itself.
Page: 1 2