ID:2510911
 
(See the best response by Lummox JR.)
I'm new to doing BYOND stuff but I'm muddling through the basic steps by browsing around. This is eluding me, though; I've got a setup for client-sided saves (I'm in Australia so I'd want to have other people hosting for me or else it gets really laggy for overseas players, and therefore it's useful for saves to be key-based and client-sided rather than server-sided). At the moment it looks like this:

mob/proc
SavePlayer()
var/savefile/F = new()
Write(F) //saves all non-tmp vars in the src mob
client.Export(F) //exports save file to key
LoadPlayer()
var/savefile/F = client.Import()
if(F) Read(F) //get savefile from client and apply
..()


This compiles and runs, but on calling LoadPlayer() in-game (I have a verb set up to call it, and it calls automatically as part of Login()), this happens:

//where keyname is the key of the user
runtime error: bad file
proc name: LoadPlayer (/mob/proc/LoadPlayer)
usr: (src)
src: keyname (/mob)
src.loc: null
call stack:
keyname (/mob): LoadPlayer()
keyname (/mob): Login()


Any ideas what I've done wrong?
Best response
Do you have a hub entry? Client-side savefiles are saved differently per hub entry, so if you don't have one or it isn't setup in such a way that Dream Seeker can tell which game it belongs to, it won't save right.

Mind you, client-side saves are an iffy business. They're prone to tampering and there's ultimately nothing you can do to prevent that, only to mitigate it.
Hrrm... no, since this is nowhere near ready for release. I'll rewrite it as server-sided for now.