How to save verbs and load 'em? in Developer Help
|
|
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.
|
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.