Code:mob
var
lastx
lasty
lastz
password
Name
proc
regular_login()
usr.loc=locate(lastx,lasty,lastz)
usr.icon='Player.dmi'
usr.icon_state=""
world <<"[usr] has logged in!"
password_login(mob/M as mob)
Name=input("Input a character name to create or load") as text
if(!Name) password_login()
if(fexists("players/[Name]/.sav"))
var/savefile/F=new("players/[Name]/.sav")
var/gotit
F["password"]>>gotit
var/pass=input("Input your character's password.","Security") as text
if(pass==gotit)
alert("Correct. Welcome back.")
usr.Load(src)
usr.icon='Player.dmi'
usr.icon_state=""
else
alert("Failed attempt.")
del(src)
else
lol
usr.password=input("Enter a password for your character.") as text
var/correctpass=input("Please enter it again.") as text
if(correctpass==password)
regular_login()
Load()
else
alert("The two passwords did not match. Enter them both again.")
goto lol
SaveProc(mob/M as mob)
var/FileName="Players/[ckey(src.key)].sav"
if(fexists(FileName)) fdel(FileName)
var/savefile/F=new(FileName)
Write(F)
F["password"]<<src.password
F["Level"]<<src.Level
F["Exp"]<<src.Exp
F["Nexp"]<<src.Nexp
F["HP"]<<src.HP
F["MaxHP"]<<src.MaxHP
F["Taijutsu"]<<src.Taijutsu
F["Def"]<<src.Def
F["Lastx"]<<src.x
F["Lasty"]<<src.y
F["Lastz"]<<src.z
src<<"Character Saved..."
Load(mob/M as mob)
var/savefile/F=new("players/[M.Name]/.sav")
if(fexists("players/[name]/.sav"))
M.Read(F)
F["Level"] >> M.Level
F["lastx"] >> M.lastx
F["lasty"] >> M.lasty
F["lastz"] >> M.lastz
F["password"] >> M.password
F["Taijutsu"]>>M.Taijutsu
F["Def"]>> M.Def
F["Exp"]>>M.Exp
F["Nexp"]>>M.Nexp
F["HP"]>>M.HP
F["MaxHP"]>>M.MaxHP
loc=locate(lastx,lasty,lastz)
del(F)
Login()
password_login()
Logout()
SaveProc()
del(src)
Problem description: Okay so When i run game it ask for Name and Password but the Name and Password is the only thing that is saved.It doesnt save and/or load the players last location or Stats. Can anyone tell me what im doing wrong? This my first time coding from scratch
i get : runtime error: Cannot read null.Name
proc name: Load (/mob/proc/Load)
usr: Sstrunks9999 (/mob)
src: Sstrunks9999 (/mob)
call stack:
Sstrunks9999 (/mob): Load(null)
Sstrunks9999 (/mob): password login(null)
Sstrunks9999 (/mob): Login()
</<src></<src></<src></<src& gt;</<src></<src></<src></< src></<src></<src></<src>
ID:138724
Jan 5 2012, 8:21 am (Edited on Jan 5 2012, 8:29 am)
|
|
One thing I noticed is that the Load and Save paths are different.