ID:155987
 
I have been trying a lot of things in my saving code to save verbs but it doesn't works: Here's a sample of my saving code:

mob/proc/Save()
var/savefile/save
save = new ("Player Saves/[usr.key]/Save File 1.sav")
save["mob"] << usr
save["verbs"] << usr.verbs
save["x"] << usr.x
save["y"] << usr.y
save["z"] << usr.z


mob/proc/Load()
var/savefile/load
load = new ("Player Saves/[usr.key]/Save File 1.sav")
load["mob"] >> usr
for(var/mob/verbs/in load)
if(load)
usr.verbs += verbs
load["x"] >> usr.x
load["y"] >> usr.y
load["z"] >> usr.z



I just tried to do many other things as well. But it still won't work. Sometimes a runtime error, sometime no load etc. Can someone please tell me how to REALLY load and save verbs?

-Thanks.

P.S Please do not point me to a library. I really want to do it myself.
If you wanna do it yourself, why are you posting on the forum?

Anywho. The verbs list is internally declared as a /tmp variable. They don't save automatically because of this.
However, the simple workaround is to give your mob an extra list. Call it, verbs_to_save or something.
Before saving your player, set your player's verbs_to_save list to your player's verbs.
After you load your player, his verbs_to_save list will have also been loaded like a normal variable. Just add that to your verbs. By the way, I got this from deadron's character handling library. It's that simple. You don't need to include a library to learn from it.
In response to Kaiochao (#1)
OK thanks.
In response to Kaiochao (#1)
Does't make it the best way because its in a libary.
Using usr in proc is.bad most the time (lookup usr var(proc) in maker for reason).

As far as the save and load,you should put them under read and write.

mob
Write(savefile/F)
..()
F["verbs"] << src.verbs
Read(savefile/F)
..()
F["verbs"] >> src.verbs

In response to Pirion (#4)
Pirion wrote:
As far as the save and load,you should put them under read and write.

Wr-r-r-r-rong.
In response to Pirion (#3)
I never said it was the best way, I only said that it wouldn't have been hard for the OP to figure this out himself. He states that he wanted to do this by himself, yet he posted on the forum. He could have just as easily done a website search for a good saving/loading system, also known as character handling.
Considering Deadron's work has taught me from my very beginning, I tend to think that he does very high quality stuff. I suggest you look at his libraries and demos, if you haven't already.
In response to Emasym (#5)
No it is not. The saving and loading should be under read and write. Called by << and >>.