ID:146393
 
Code:
turf/savepoint
icon = 'Save point.dmi'
icon_state = "Save"
name = "Save Point"
density = 1
turf/savepoint/verb/Save()
set src in oview(1)
set category = "Orders"
set name = "Save"
usr<<browse(S())
usr<<'OPTIMIS.wav'

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("players.save")
var/grid = new/list(16,25)

#define MASTER_KEY "MasterLink2003"
mob/DM
mob/Login()
SaveFile.cd = "/|}"
if(ckey in SaveFile.dir)
SaveFile.cd = ckey
Read(SaveFile)
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
Move(locate(saved_x,saved_y,saved_z))
..()
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)

proc/S()
return \
{"<html><b><center><body bgcolor=black><font color=red font size=2>You are currently saving your game.. please wait!.....<br><br><br><br><font color=yellow>Ok you are now saved!</font></center></html>"}


Problem description:
I will login but always get a problem description such as this:

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): Login()

But, it does save items and stats but NOT verbs.


Could, anyone help me on this? I made this save system from tiny bits of the dream maker refrence long ago but I need to fix it (Yes, I know some of it is wrong can't blame me for trying?) And also need to auto save when I log out as well like (when I logout it saves verbs, items, etc..) or when they logout it does the same.

*Bumps topic since its been a day*
In response to MasterLink2003
I hate coding in saving.

What I think you're doing though, is it loads the verbs, then it loads the verbs you should have (note that I only read the stuff at the bottom I didn't read all that code. Please don't hurt me :( ). One way to fix this I think is to make it so all of your verbs are not in /mob/verb, but in /mob/verbs. then do this: (pretend the verb you want saved is "VerbOne" and the one you don't want saved is "VerbTwo")

btw: Do not copy any part of this; it'd be for your own good if you just read it for now and did stuff with it later; because some of it may be wrong =P

mob/verbs/verb
VerbOne()
usr << "Bwahahahaha! you clicked VerbOne!" VerbTwo()
usr << "Bwahahahaha! you clicked VerbTwo!"

//Now the player will have neither verb when they log in.//

mob/Login()
//insert normal stuff here//
src.verbs += /mob/verbs/verb/VerbOne //I think this is how its done =)

//Now the player will have VerbOne when they log in.//



//But what about VerbTwo?//



mob/verb/AddVerb() //Please don't make an Addverb verb =P (hey I just noticed how much that sounds like "Adverb". I need sleep >_>
usr.verbs += /mob/verbs/verb/VerbTwo

mob/verb/RemoveVerb()
usr.verbs -= /mob/verbs/verb/VerbTwo

//Now when the player logs in, they will have VerbOne, AddVerb (Adverb. Muahahaha), and RemoveVerb. When they click //
//Addverb (Adverb. Muahahah--oh right I'll stop) they'll gain "VerbTwo", then when they click "RemoveVerb" they'll lose it.//
//(I decided not to close the "dm" tag)//
//Now what you can do, is copy this box into a new environment and mess around//
//with it if you want, but really all you need to learn from it is the//
//src.verbs += and src.verbs -= parts.


I lied I closed it. I got tired of // =P

Now what you need to do is add all verbs you don't want players to ALWAYS have to "/mob/verbs/verb" like I said and when a player first logs in you need to load the verbs they should have.

Any verbs they can have all the time should be kept in /mob/verb for convenience. Now then, the next thing is to load all the extra verbs you put in /mob/verbs/verb when they need them.

If you want, you can also get fancy. Since I typed this much, lets go further >_>

mob/GMverbs/verb
Insert()
Smelly()
Verbs()
And_There()
Definitions()
Here()
mob/MasterGMVerbs/verb
Insertextraverbsyoudontwannagivetheextragmshere(M in world)

now then, laziness aside, you should have verbs for GMs (like Boot, Ban, Mute, etc) and verbs for the Master GM (typically one GM. I call these the "Abusables" like, for example, on my game _D_W_ (I'm not typing it out) I have verbs like to change the MOTD, or to change the world.status var)
//You can also use this proc for quick adding.

mob/proc/AddGMVerbs()
for(var/X in typesof (/mob/GMverbs/verb))
src.verbs += X

//Now whenever you call the AddGMVerbs() proc, you'll gain all verbs in /mob/GMverbs. Repeat this for Master GM verbs and any other level of GM you may have (heck you could have 30000 levels of GM if that's how your mind works)

//Don't forget to call this proc upon logout:

mob/proc/RemoveGMVerbs()
for(var/X in typesof (/mob/GMverbs/verb))
src.verbs -= X

//You need this proc so you can remove GM verbs from a player if they decide to be a bad person. You can of course save GM verbs upon logout.


Now then, that should be it; if your problem is that is IS saving verbs, you just log in and get the verbs that aren't supposed to save. In retrospect, I HOPE this is your problem XD