ID:139853
 
Code:
Well, I fiddled around with my Save coding, and I got it to save the inventory, variables, and loc of the user. But I'm having some trouble with the verbs. Anyone help? Save Script:
mob
proc
Save()
var/savefile/F = new("[ckey].sav")
F["mob"] << src
Load()
if(fexists("[ckey].sav"))
var/savefile/F = new("[ckey].sav")
F["mob"] >> src

mob
Write(var/savefile/F)
..()
F["x"] << src.x
F["y"] << src.y
F["z"] << src.z
F["a"] << src.controlled
F["b"] << src.icon_state
F["c"] << src.contents
F["d"] << src.overlays
F["e"] << src.vee
F["f"] << src.vree
Read(var/savefile/F)
..()
F["x"] >> src.x
F["y"] >> src.y
F["z"] >> src.z
F["a"] >> src.controlled
F["b"] >> src.icon_state
F["c"] >> src.contents
F["d"] >> src.overlays
F["e"] >> src.vee
F["f"] >> src.vree

Calling Save/Load:
mob
Login()
if(fexists("[ckey].sav"))
world<<"<font color = purple>[usr.name] has logged in."
src<<"Welcome to Hogwarts: Reborn!"
icon='ICONS.dmi'
src.frozen=0
src.loc=locate(3,3,1)
src.mut=0
var/obj/O = list("Colin1011", "Revail94", "Seteden", "LegoLover") // for every key you want to be GM place in this list
src.Load()
src.verbs+=typesof(src.vee)
if(src.key in O)
src.verbs+=typesof(/mob/Admin/verb/)
src<<"You are a GM."
src.TransLevel=100
src.WPK=1
src.BCK=1
src.SSK=1
src.ShSK=1
src.WSPK=1
src.Year="Graduated"
Logout()
src.vee+=src.verbs
src.vree+=src.vars
src.Save()
world<<"<font color = purple>[src.name] has logged out."
del(src)

Variables:
mob/var/vee=list("")
mob/var/vree=list("")

Problem description: I would appreciate any help, but of course, it's your choice whether to help me or not.

im pretty sure to save a list you have to save it as text so you use list2params(), when your loading it you use params2list().
In response to Masschaos100
Masschaos100 wrote:
im pretty sure to save a list you have to save it as text so you use list2params(), when your loading it you use params2list().

Next time be ABSOLUTELY sure, because you're completely wrong here.
You do not need to manually save controlled, icon_state, contents, overlays, vee, or vree, as those will all be saved by default (assuming they aren't delcared as tmp). And if you did, you shouldn't store them under "a", "b", etc. Use actual goddamned names so it MAKES SENSE.

As for your issue: typesof() does not work that way. What you should do is get rid of the vee and vree lists (which are INCREDIBLY poorly named, by the way), and instead just do this:

mob/Write(var/savefile/F)
..()
F["x"] << x
F["y"] << y
F["z"] << z
F["verbs"] << verbs
mob/Read(var/savefile/F)
..()
loc = locate(F["x"], F["y"], F["z"])
verbs += F["verbs"]


Oh, also, putting Load() in Login() is wrong. It should go in client/New(). Loading the mob from the savefile is going to create a NEW mob for the player, so anything you do to src is going to screw things up. By the same token, making Load() a /mob proc instead of a /client proc is also wrong.
In response to Garthor
Thanks. Dunno how you got so good at coding =D Just hope I will sometime.