ID:178119
 
Could someone tell me how to make a save verb? and don't tell bout the deadons char handling, its too confusing for me!
mob
verb
save()
var/savefile/F = new("[usr.ckey].sav")
Write(F)//look you saved!
usr << "Sucessfully wrote [F]."
In response to Nadrew
how would i load the save?
In response to Redslash
Using that exact code you were given change the following:

mob/verb/save() to mob/verb/load()


Write(F) to Read(F)
In response to Nadrew
so simple... yet so complex....
In response to Nadrew
*Thud*oww... whats this? i loaded my game and poof! a iant screen of NOTHING! how do i get past it?
In response to Redslash
Make sure you have ..() in Login(), if you have it in your code.
In response to Redslash
Redslash wrote:
so simple... yet so complex....

Nothing complex about that..
do this to save your guy's coreds..
mob
Login()
..()
Write(savefile/F)
..()
if (world.maxx)
F["last_x"] << x
F["last_y"] << y
F["last_z"] << z
Read(savefile/F)
..()
if (world.maxx)
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)


RaeKwon
In response to RaeKwon
your right... nothing simple...
In response to RaeKwon
How would i save my char icon? it doesn't want to save for me.
In response to Redslash
Redslash wrote:
How would i save my char icon? it doesn't want to save for me.

mob
Write(savefile/F)
F["name"] << name // Saves there name
F["icon"] << icon // Saves there icon..
Read(savefile/F)
F["name"] >> name // Loads there name
F["icon"] >> icon // Loads there icon..


RaeKwon
In response to RaeKwon
That code isn't working...
In response to Redslash
Redslash wrote:
That code isn't working...

Well duh you have to call them!
In response to RaeKwon
RaeKwon wrote:
Redslash wrote:
That code isn't working...

Well duh you have to call them!
mob
Logout()
var/savefile/F = new(ckey)
Write(F)
del src
Login()
var/savefile/F = new (ckey)
Read(F)
return ..()


By any chance, are you a very very very very early coder? :P

RaeKwon
In response to RaeKwon
lol i was putting << to load, oops!
On a related note, how would you put the save file on a server rather than the client's computer?
Redslash wrote:
Could someone tell me how to make a save verb? and don't tell bout the deadons char handling, its too confusing for me!

byond://Deadron.SimpleSaving

That demo shows that all you have to do to use my CharacterHandling library is include the library...not one more line of code is needed!