ID:169285
 
My save never works. I tried 3 of my own ways, and a few libraries. But everytime i get :

---------------------------------------
runtime error: Failed to write variable Client to savefile players/rean/mobs.sav. The value being written was Rean (/client).
proc name: Write (/mob/Write)
source file: SaveSystem.dm,112
usr: Kasouke-Ichago (/mob/players/Cloud)
src: Kasouke-Ichago (/mob/players/Cloud)
call stack:
Kasouke-Ichago (/mob/players/Cloud): Write(players/rean/mobs.sav (/savefile))
Kasouke-Ichago (/mob/players/Cloud): SavePlayer()
Kasouke-Ichago (/mob/players/Cloud): Save()
---------------------------------------------------
My save codes i have tried but got same exact error in same wording:
mob/var/lastx
mob/var/lasty
mob/var/lastz
var/players=new/list()

client/proc/SaveMob()
usr.lastx=usr.x
usr.lasty=usr.y
usr.lastz=usr.z
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("Players/[firstletter]/[src.ckey].sav")
var/char_ckey = cKey(src.mob.name)
F["/[ckey]/[char_ckey]"]<<src.mob
src<<"Save Complete!"
sleep(1)

client/proc/LoadMob(char_ckey)
var/firstletter=copytext(src.ckey, 1, 2)
var/savefile/F = new("Players/[firstletter]/[src.ckey].sav")
F["/[ckey]/[char_ckey]"]>>src.mob

src<<"Load Successful"

----
mob/proc
Savee()
var/savefile/F = new("Save/[src.ckey]")
F["x"] << src.x
F["y"] << src.y
F["z"] << src.z
F["src"] << src
Write(F)
src << "<center>SAVED"
Loadd()
var/savefile/F = new("Save/[src.ckey]")
if(fexists(F))
Read(F)
F["x"] >> src.x
F["y"] >> src.y
F["z"] >> src.z
F["src"] >> src
src.loc = locate(x,y,z)
//src << sound('Main.mid',1)

Also Raekwons
mob/var/list/CV
var/tmp/host=null
mob/verb
Save()
usr.SavePlayer()
mob/proc
SavePlayer(){src.CV=src.verbs;
var/savefile/F=new("players/[src.ckey]/mobs.sav");
var/char_ckey=cKey(src.name);F["/[ckey]/[char_ckey]"]<<src}
LoadPlayer(char_ckey){
var/mob/n;var/savefile/F=new("players/[src.ckey]/mobs.sav");
F["/[ckey]/[char_ckey]"]>>n;for(var/item in n.CV)n.verbs+=item}
PlayerList(){
var/savefile/F=new("players/[src.ckey]/mobs.sav");
F.cd="/[ckey]";var/list/players=F.dir;return players}
CC()
switch(input("What would you like to do today?","[world.name]")in list("Create Character","Load Character","Delete Character","Quit"))
if("Load Character"){
var/list{players=src.PlayerList();listing=new()};
listing+=players;
var/selection=input("Which character do you wish to load?", "Load Character") as null|anything in listing;
src.LoadPlayer(selection)}
if("Create Character"){usr.CreateCharacter()}
if("Delete Character"){there;
var/savefile/F=new("players/[src.ckey]/mobs.sav");
F.cd="/[ckey]";var/list{Players=F.dir;listing=new()};
var/Cancel="Cancel";listing+=Players;listing+=Cancel;
var/selection=input("Which character do you wish to delete?","Deleteing Character") in listing;
if(selection){F.cd="/[ckey]";F.dir.Remove(selection)};if(selection==Cancel){usr<<"Alright.";usr.CC()};
else goto there}
mob
ppp/Choosin
Login(){KillVerbs();spawn(){usr.CC();KillVerbs()}}
Logout(){return}
proc/KillVerbs()for(var/verbe in verbs)verbs-=verbe
Login()
..()
Write(savefile/F){..();F["S_x"]<<x;F["S_y"]<<y;F["S_z"]<<z}
Read(savefile/F){;..();var{S_x;S_y;S_z};F["S_x"]>>S_x;F["S_y"]>>S_y;F["S_z"]>>S_z;loc=locate(S_x,S_y,S_z)}
client
Del(){..();usr.SavePlayer()}
mob/proc/CreateCharacter()//The proc, always keep the proc mob/proc/CreateCharacter Till your a better coder (or if you are look in RaeKwon Saving.dm and change the proc when you find it)
start
var/charactername = input("What is your name?","Name","Kasouke-Ichago") as text|null//Picking your name
if(length(charactername) >= 20)//Limits the name to 20 letters includeing spaces long.
alert("Name Too Big")
goto start://If there name is over 20 letters.. Byebye!
if(!charactername)
goto start:
var/prompt_title="New Character"//The title (for the top of the window
var/list/races=list("Warrior")//The races you will have a choice of, simply edit to your standards
var/char_race=input(src,prompt_title) as null|anything in races//Makes the window
var/mob/new_mob//Defines new_mob car
switch(char_race)//switches char_race, for which class you picked.
if("Warrior")new_mob=new/mob/players/Cloud()//Makes them a warrior!
new_mob.name="[html_encode(charactername)]"//Makes the player's name, also removes any HTML they include in there name
src.client.mob=new_mob//Makes there default mob the mob you selected in Creating your character
del src//Deletes the person, then calls Login (Magically!)

I even restarted my computer (wich solved missing rsc problems) but I cant figure out why it doesnt save! It saves in other games. Like i have another game and it saves but i used that save system and same error. Anyone know why?
This works fine for me:

client/proc/SaveMob()
var/savefile/F = new("players/[src.ckey].sav")
F["src"]<<src.mob
F["attack"]<<mob.attack
F["icon"]<<mob.icon

client/proc/LoadMob(char_ckey)
var/savefile/F = new("players/[src.ckey].sav")
F["src"] >> src.mob
F["attack"]>>mob.attack
F["icon"]>>mob.icon

mob/verb/Save()
src.client.SaveMob()

mob/verb/Load()
src.client.LoadMob(src.key)
del(src)
mob
Read(savefile/F)
..()
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x, last_y, last_z)

Write(savefile/F)
..()
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z


Also, don't use usr in procs.
In response to DeathAwaitsU
Thanks, ill tell you the results
In response to DeathAwaitsU
-------------------
<font color=red>
players/rean.sav. The value being written was Rean (/client).
proc name: Write (/mob/Write)
source file: SaveSystem.dm,167
usr: Rean (/mob/players)
src: Rean (/mob/players)
call stack:
Rean (/mob/players): Write(players/rean.sav (/savefile))
Rean (/client): SaveMob()
Rean (/mob/players): Save()
--------------------------------------
</font>
Same exact error...
I changed some things around:
mob/var/lastx
mob/var/lasty
mob/var/lastz
client/proc/SaveMob()
var/savefile/F = new("players/[src.ckey].sav")
F["src"]<<src.mob
//F["attack"]<<mob.attack
F["icon"]<<mob.icon
mob.Write(F)

client/proc/LoadMob(char_ckey)
var/savefile/F = new("players/[src.ckey].sav")
F["src"] >> src.mob
//F["attack"]>>mob.attack
F["icon"]>>mob.icon
mob.Read(F)

mob/verb/Save2()
src.client.SaveMob()



mob/verb/Load()
src.client.LoadMob(src.key)
del(src)
mob
Read(savefile/F)
..()
var/last_x
var/last_y
var/last_z
F["last_x"] >> last_x
F["last_y"] >> last_y
F["last_z"] >> last_z
loc = locate(last_x, last_y, last_z)

Write(savefile/F)
..()
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z

and i saved twice and said
Error: Removal of locked savefile path '/.0
a billion times until it froze the game!
Atleast its not the same error.
Anyone help?
In response to Rean
WTF?!!? I GOT ANOTHER SAVE SYSTEM AND ON THE DEMO IT WORKED FINE BUT WHEN I PUT IT INTO MY GAME IT SAID THE SAME EXACT ERROR! IM GETTING PISSED OFF. PLEASE HELP BEFORE I LOSE MY MIND!!!
mob
proc
Save() // This is the proc that saves the player
var/savefile/F = new("Save/[src.ckey]") // This creates a new file called your key.sav in the file Save
F["last_x"] << src.x// This stuff saves the players location
F["last_y"] << src.y
F["last_z"] << src.z
Write(F) // This Writes the file
Load()
if(fexists("Save/[src.ckey]")) // This checks if they player has a savfile
var/savefile/F = new("Save/[src.ckey]")
Read(F) // This reads the file!
F["last_x"] >> src.x
F["last_y"] >> src.y
F["last_z"] >> src.z
verb{Save_The_Game(){usr.Save()}Load_The_Game(){usr.Load()}}
world{maxx=10;maxy=10;maxz=1}
In response to Rean
Rean wrote:
WTF?!!? I GOT ANOTHER SAVE SYSTEM AND ON THE DEMO IT WORKED FINE BUT WHEN I PUT IT INTO MY GAME IT SAID THE SAME EXACT ERROR! IM GETTING PISSED OFF. PLEASE HELP BEFORE I LOSE MY MIND!!!

WOOT I HAVE ALREADY LOST MY MIND I EVEN GOT MYSELF BANNED FROM BYOND ITSELF ONCE AND NOW I HAVE A SECOND CHANCE BUT THATS NEITHER HERE NOR THERE. WTF?????!!!! WHATS WITH THE CAPS, DUDE?

..
Yeah, what's with the caps?

*cough*
You can't write /client to a savefile. It isn't allowed to save at all.
*cough*
In response to Rean
maybe you should start writing your own save system, or learn from the demos, because you don't have a clue with what you're doing.

O-matic
In response to Phoenix Man
I wrote my own save system and it works fine on my other game it just doesnt work in my main game. Just my luck. Anyone know why this is happening?
I guess i cant do /client. Sux becuase now i gotta save each and every variable, verb, etc wich will take a while but its worth it.