mob/verb/Save()
set category = "Orders"
usr<< browse(S())
world<<"<font color=white font size=1>[usr.name] has saved their Journey!</font>"
var/savefile/F = new()
F << usr //write the player's mob
usr.client.Export(F)
client/New()
var/client_file = Import()
if(client_file)
var/savefile/F = new(client_file) //open it as a savefile
F >> usr //read the player's mob
return ..()
mob
var{saved_x;saved_y;saved_z}
Write(savefile/F)
saved_x = x
saved_y = y
saved_z = z
..()
Read(savefile/F)
..()
Move(locate(saved_x,saved_y,saved_z))
var/savefile/SaveFile = new("journey.save")
#define MASTER_KEY "MasterLink2003"
mob/DM
mob/Login()
SaveFile.cd = "/|}"
if(ckey in SaveFile.dir)
SaveFile.cd = ckey
Read(SaveFile)
usr << "Welcome back, [name]!"
else
usr.loc=locate(3,49,1)
..()
mob/Write(savefile/F)
//store coordinates
F << x
F << y
F << z
//store variables
..()
mob/Read(savefile/F)
var {saved_x; saved_y; saved_z}
//load coordinates
F >> saved_x
F >> saved_y
F >> saved_z
//restore variables
..()
//restore coordinates
Move(locate(saved_x,saved_y,saved_z))
mob/Write(savefile/F)
F["name"] << name
F["gender"] << gender
F["icon"] << icon
F["Icon_state"] << icon_state
mob/Read(savefile/F)
F["name"] >> name
F["gender"] >> gender
F["icon"] >> icon
F["Icon_state"] >> icon_state
mob
Login()
var/savefile/F = client.Import()
if(F) Read(F) //restore properties
..()
proc/SavePlayer()
var/savefile/F = new()
Write(F) //save properties
client.Export(F)
mob/Write(savefile/F)
var/V
for(V in vars)
if(issaved(vars[V]))
if(initial(vars[V]) == vars[V])
F.dir.Remove(V) //just in case
else F[V] << vars[V] //write variable
mob/Read(savefile/F)
var/V
for(V in vars)
if(issaved(vars[V]))
if(V in F.dir)
F[V] >> vars[V] //read variable
client/Center()
var/obj/O
var/obj/LastO
for(O in usr.loc) LastO = O
if(LastO) //top most obj
LastO.Move(usr)
var/grid = new/list(16,25)
proc/S()
return \
{"<html><b><center><body bgcolor=black><font color=red font size=2>You are currently saving your game.. please wait!<br>Ok you are now saved!</center></html>"}
It saves all the stats and objs. But, when I run it I get this runtime error.
runtime error: Cannot read 'savefile'.dir proc name: Read (/mob/Read) usr: MasterLink2003 (/mob) src: MasterLink2003 (/mob) call stack: MasterLink2003 (/mob): Read('savefile') MasterLink2003 (/mob): Read('savefile') MasterLink2003 (/mob): Login() runtime error: bad savefile or list proc name: Read (/mob/Read) usr: MasterLink2003 (/mob) src: MasterLink2003 (/mob) call stack: MasterLink2003 (/mob): Read('savefile') MasterLink2003 (/mob): Login()
Yes, I still get that runtime error as well.