ID:165302
 
Hm... OK... I have a autosave code. A proper one I made, in which it saves on logout and loads (if wanted) on login.

Now, I used it when I coded for Pokemon AquaBlue, and there was a lot of calling of save loses. It worked fine offline, though I can't really test it online without support from the public.

The 'autosaves' in the BYOND libraries and all are just stupid, slow clockwork saving systems, in which not only would be slow in a high capacity server, if you don't wait X seconds/minutes you get your save wiped.

Is there actually a autosave system (The one in the first paragraph I described) I could have or something?
Well, heres mine.

mob
proc
Save() //Save proc
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("players/[firstletter]/[src.ckey].sav")//makes a save file
F["mob"]<<src
Write(F) // Writes the stored files into one
src.Save()

In response to Revojake
No no, thats just a save code.

An autosave code to me... its that, but it automatically does it on logout, so you don't need to worry.
In response to RedlineM203
RedlineM203 wrote:
No no, thats just a save code.

A very very poor save code that likely doesn't even work at all.
RedlineM203 wrote:
Now, I used it when I coded for Pokemon AquaBlue, and there was a lot of calling of save loses. It worked fine offline, though I can't really test it online without support from the public.

There are two possibilities. The first is that, like you're saying, the player isn't getting saved in the first place. The second one is that everything *is* saving fine, but you have a rollback bug. When you load a player, you might also by accident load an obj or a list that references another player, causing them to roll-back to that earlier version.
In response to RedlineM203
What, you mean like...

mob/Logout()
Save()
del src


??

~ Chance
In response to Jon88
Hmmm... well, this is the logout code:

mob/Logout()
if(client.IsByondMember())
world << "<small><font color = red><b>Logout info: <font color = black>Byond Member [src]/[key] leaves us."
else
world << "<small><font color = red><b>Logout info: <font color = black>[src]/[key] leaves us."
if(src.client)
for(var/mob/M in src.petlist)
if(M.owner==src.key)
pet.pokeball = 1
pet.following=0
pet.standing=0
pet.wandering=1
pet.attacking=0
pet.loc = locate(3,298,1)
del(pet)
spawn() //Redline: Fault in my old code, without Spawn this causes the clone bug.
src.Save()
..()
del(src)
..()


The spawn is the prime suspect, though its stopping a clone bug. There is 2 other coders on the game, so I dunno why the hell there is 2 ..()s and a del(src), that might be a problem. I'm sort of afraid to make changes without knowing what would happen online.
In response to RedlineM203
Why the heck are there client stuff in there?

mob/Logout() is called AFTER the client leaves, meaning that client == null, so all that refers to the client (such as if(src.client)) will not work :\

And I say you're right about the spawn()... why would it save after the mob has been deleted o.O Maybe you should look into the save system to see if it makes a clone?

And there's no point for ..() to be after the del src as the mob would be deleted by than and no parent proc to go to

- GhostAnime
In response to GhostAnime
Well, I always thought that ..() was the actual logout of the player in the proc, so I used that if(src.client) to check if it was actually a player, in which it checks the the list of pets they own so they go back into the pokeball and get deleted. (After weeks of hosting, we found out that the pokemon are actually saved with the player's savefile)