I got this code for saving which is an edited version of K'ros_Trikare's save demo:
mob
Login()
var/saveingsellect = input("Character Login")in list("New","Old","Delete","Exit")//simple way of calling a list
switch(saveingsellect)//switch it so that you can see if its new old delete or exit
if("New")//if new...
usr.name = input("Your name?")as text//make them able too choose there name
usr.loc=locate(316,4,2)
//after this do your codeing if you want like icon and such
if("Old")
if(fexists("players/[src.ckey].sav"))//this checks if theres a player save file
var/savefile/F = new("players/[src.ckey].sav")//this defines the F as a save file in the players directory
var/X//this is a X var that we'll use later on for locateing the user
var/Y
var/Z
F["name"] >> name//this checks the savefiles var = name and it outputs it to the character. your going to want to add another one of these for each var
F["X"] >> X//this outputs the X var which we will put into the F later on
F["Y"] >> Y//same as X
F["Z"] >> Z//same as X/Y
F["icon"] >> icon
F["pl"] >> src.pl
F["power"] >> src.power
F["level"] >> src.level
F["tech"] >> src.tech
F["str"] >> src.str
F["fly"] >> src.fly
F["inner"] >> src.inner
F["airborne"] >> src.airborne
F["mp"] >> src.mp
F["gravityboo"] >> src.gravityboo
F["exp"] >> src.exp
F["verbs"] >> verbs
usr.loc = locate(X,Y,Z)//locates the user to teh saved x/y/z
else
usr.Login()//if there is no save file bring themb ack to the begining
if("Delete")
if(fexists("players/[src.ckey].sav"))//check if theres a save file
var/savefile/F = new("players/[src.ckey].sav")//define the savefile
del(F)//delete the save file
usr.Login()
if("Exit")
del(usr)//Make the user logout
//Okay well thats the saveing now ill show you how to do a save verb
mob/verb
Save()
set category="Save Every Few minutes"
var/savefile/F = new("players/[src.ckey].sav")//define savefile
F["name"] << name//input the users name into the savefile
F["icon"] << icon
F["X"] << src.x//okay so heres where the x/y/zs come in this just saves the users current locatin..pretty simple ;)
F["Y"] << src.y
F["Z"] << src.z
F["pl"] << src.pl
F["power"] << src.power
F["level"] << src.level
F["tech"] << src.tech
F["str"] << src.str
F["fly"] << src.fly
F["inner"] << src.inner
F["airborne"] << src.airborne
F["mp"] << src.mp
F["gravityboo"] << src.gravityboo
F["exp"] << src.exp
for(var/V in src.verbs)
F["verbs"] << V
//okay so were all done make sure to add one of the those F["varname"] << varnametowrite on the save
//i hope everyone will like this and use it wisley...if you dont mind give me some credit ;)
Problem is, I can't get it to load the aquired verbs(runtime error*)
Any help would be good.
--Ray
*Runtime error:
runtime error: Cannot write to atom.verbs.
proc name: Login (/mob/Login)
usr: Ray (/mob)
src: Ray (/mob)
call stack:
Ray (/mob): Login()
ID:261810
Jul 31 2003, 4:16 am
|
|
~Kros