ID:263082
 
Code:Heres my loading proc
mob
proc
Load()
var/savefile/F = new()
F["usr"]>>src
F["x"]>>src
F["y"]>>src
F["z"]>>src
usr.client.Import(F)

Heres my Click() Function
obj
Title_Screen
Load_Game
name = ""
density = 0
icon = 'LoadGame.bmp'
Click()
usr.Load()
..()


Problem description:When I click the Load Game image, nothing happens. Did I go wrong in my Load() or my Click()?

Load(). You're creating an empty savefile (var/savefile/F = new()) and then trying to read from it...! It looks like you've just copied your Save() procedure and just reversed the >>/<< signs and replaced Export with Import. That's not going to do it.

What you probably meant to do was set F to new(src.client.Import()) instead of just new(). That will get the player's imported savefile.

There's another problem as well: The way you're trying to load the x, y, and z vars. You need to actually load the values into the vars themselves, not just src:

F["x"]>>src.x
F["y"]>>src.y
F["z"]>>src.z


Even that won't always work, because if src is at null then it will just stay there; setting x, y, and z independently won't work in this case. The best solution is to load the values into temporary vars and then set the coordinates all at once by using locate(), like this:

var/X
var/Y
var/Z
F["x"]>>X
F["y"]>>Y
F["z"]>>Z
src.loc = locate(X, Y, Z)
In response to Crispy
New Error

Cannot execute null.Import().
proc name: Load (/mob/proc/Load)
usr: Dead_Demon (/mob/C)
src: 2
call stack:
2: Load()
(/obj/Title_Screen/Load_Game): Click(the turf (15,3,4) (/turf))

mob
proc
Save()
var/savefile/F = new(src.client.Export())
F["usr"]<<src
F["x"]<<src.x
F["y"]<<src.y
F["z"]<<src.z
usr.client.Export(F)


Load()
var/savefile/F = new(src.client.Import())
F["usr"]>>src
F["x"]>>src
F["y"]>>src
F["z"]>>src
usr.client.Import(F)