ID:145350
 
Code:
mob/player 
Login()
usr << sound('kingdomhearts-hikari3.mid',1)
world << "<b> \white [usr] logs on!"
alert("Welcome to Kingdom Hearts","Welcome","Ok")
src.name = input("What is your characters name?","Name",src.key)
var/a = input("What class do you want?")in list("Sora")
if(a=="Sora")
usr.icon = 'sora2.dmi'
switch(alert("Do you want to write in your profile?","Profile?","Yes","No"))
if("Yes")
usr.profile = input("Enter a profile:","Your Profile",usr.profile)

usr.loc = locate(10,10,2)

mob/player
Logout()
world << "<b> \white [usr] logs out!"
sleep(5)
del(src)


Problem description: Well, I can't plug in a save system to work with this code. I tried some symple saving and saving verbs, but nothing works. Any help?

1. No usr in Login!
2. you simply call a Load() proc at mob/Login() , and call the Save() proc on mob/Logout! >.> Plenty demos out there.
In response to Mysame
And since you kindly asked, here is one just for you! >_>

client
proc
save()
var/savefile/F=new("[world.name]/players/[mob.ckey].sav")
F["mob"]<<mob
F["lst_z"]<<mob.z
F["lst_x"]<<mob.x
F["lst_y"]<<mob.y
load()
if(!fexists("[world.name]/players/[mob.ckey].sav"))return
var/savefile/F=new("[world.name]/players/[mob.ckey].sav")
F["mob"]>>mob
F["lst_z"]>>mob.z
F["lst_x"]>>mob.x
F["lst_y"]>>mob.y
In response to DivineO'peanut
DivineO'peanut wrote:
>    F["lst_z"]>>mob.z
> F["lst_x"]>>mob.x
> F["lst_y"]>>mob.y
>


Firstly, close your tags. Secondly, the snippet I quoted won't work if the mob is located at null (coordinates 0,0,0) when it is loaded (which is probable).

Better version:

client
proc
save()
var/savefile/F=new("[world.name]/players/[mob.ckey].sav")
F["mob"]<<mob
F["lst_x"]<<mob.x
F["lst_y"]<<mob.y
F["lst_z"]<<mob.z
load()
if(!fexists("[world.name]/players/[mob.ckey].sav"))return
var/savefile/F=new("[world.name]/players/[mob.ckey].sav")
F["mob"]>>mob
var
X
Y
Z
F["lst_x"]>>X
F["lst_y"]>>Y
F["lst_z"]>>Z
loc = locate(X,Y,Z)


Indentation with only one space is pretty unreadable too, but I can't be bothered fixing that. =)
In response to Crispy
Thanks but now i need a missing var. It says theres a missing var to the last line. Please help. Thank you.
In response to Bamrulez
Being specific isn't your brightest subject, is it? :/
Well, not much is going to work with that code, as it's not safe. Login() is only slightly usr-safe, and in any system that involves saving and loading mobs that no longer applies. Use src there; it's always correct and it's safe. Logout() isn't usr-safe at all, so you should be using src there already.

Lummox JR