ID:163589
 
I know there is a tutorial on this but when i copy and paste it and even when i type it woord 4 word it nvrs works so can some1 show me the code for it that works on their dream maker?
mob/Logout()
var/savefile/F = new(ckey)
Write(F)
del(src)

mob/Login()
var/savefile/F = new(ckey)
Read(F)
return ..()


mob
var
saved_x
saved_y
saved_z

Write(savefile/F)
saved_x = x
saved_y = y
saved_z = z
..() //store variables
Read(savefile/F)
..() //restore variables
Move(locate(saved_x,saved_y,saved_z))


var/savefile/SaveFile = new("players.sav")

mob/Login()
SaveFile.cd = "/" //make sure we are at the root
if(ckey in SaveFile.dir)
SaveFile.cd = ckey
Read(SaveFile)
usr << "Welcome back, [name]!"
else
usr << "Welcome, [name]!"
..()


mob/Write(savefile/F)
//store coordinates
F << x
F << y
F << z
//store variables
..()
mob/Read(savefile/F)
var {saved_x; saved_y; saved_z}
//load coordinates
F >> saved_x
F >> saved_y
F >> saved_z
//restore variables
..()
//restore coordinates
Move(locate(saved_x,saved_y,saved_z))

mob/Write(savefile/F)
F["name"] << name
F["gender"] << gender
F["icon"] << icon
mob/Read(savefile/F)
F["name"] >> name
F["gender"] >> gender
F["icon"] >> icon

I think this might be what you are looking for...(:http://developer.byond.com/docs/guide/)
In response to Dalkon_101
mob
Login()//Login
switch(input("Welcome to (Game Name)! What would you like to do?") in list("New Game", "Load Game", "Quit")//Choose if you want to make a new game,load an old one or quit
if("New Game")//if they choose new game
src.name = input("What would you like your name to be?","Name input")//Ask their name
world << "World: [src.]([key]) has logged in."//Tell the world they logged in
if("Load Game")//if they choose load game
var/savefile/F = new("saves/[src.key].sav")
cansave = 1.
Read(F)
var/lx,ly,lz
F["last_x"] >> lx//load last x location
F["last_y"] >> ly//load last y location
F["last_z"] >> lz//load last z location
loc = locate(lx,ly,lz)
world << "World:[src]([key]) has logged in."
Save()
if("Quit")//if they quit
src.Logout()//log them out

mob
verb/Save()
var/savefile/F = new("saves/[src.key].sav")
Write(F)
F["last_x"] << x//saves x location
F["last_y"] << y//saves y location
F["last_z"] << z//saves z location
src << "Your game has been saved"//tells them their game has been saved
sleep(900)// wait a minute and a half before saving again
Save()//save
..()
Logout()
if(cansave)//if they can save
Save()//saves
world << "World:[src]([key]) has logged out."//tells world they logout
..()
del(src)

I dunno how well this compares to the one provided by Dalkon but it's a bit simpler and easier to follow I guess <_<"
Pataz wrote:
I know there is a tutorial on this but when i copy and paste it and even when i type it woord 4 word it nvrs works so can some1 show me the code for it that works on their dream maker?

Rule 1: Never Copy and Paste and call it your own work!
Rule 2: Learn how to code and try figuring out before asking
Rule 3: Never use snippets they will cause more errors unless you know how to fix them
Rule 4: Learn from libs don't copy and paste them!
Rule 5: Go over the DM guide until you know how to code and read the DM refrence(optional but recommended).

- Miran94
In response to Miran94
1.i nvr claled it my own work and i copied it after i typed it and it didnt work

2.I DID TRY thats why im askin cuz it didnt work.


Also thnxs to the other people