ID:147018
 
Bug:
runtime error: Cannot modify null.mob.
proc name: Login (/mob/create_character/Login)
source file: Login.dm,12
usr: CodingSkillz2 (/mob/create_character)
src: CodingSkillz2 (/mob/create_character)
call stack:
CodingSkillz2 (/mob/create_character): Login()
CodingSkillz2 (/client): New()
CodingSkillz2 (/client): New()


Save verb:
mob/var/saved = 0
mob/verb/save()
usr<<"Saving.."
usr.lx=usr.x
usr.ly=usr.y
usr.lz=usr.z
var/savefile/F = new("players/[src.ckey].sav")
Write(F)
F["mob"]<<usr.client.mob
usr<<"Save complete."

mob/create_character
var/mob/characters/character
Login()
if(fexists("players/[src.ckey].sav"))
var/savefile/F = new("players/[src.ckey].sav")
F["mob"]>>src.client.mob
src.loc=locate(usr.lx,usr.ly,usr.lz)
world <<"<b>[usr] has logged In"
src<<"<font color=red>We are ineed of a name but the game is about 4% done.Report any bugs with the report verb."
else
world <<"<b>[usr] has logged In"
src.New1=1
src<<"<font color=red>We are ineed of a name but the game is about 4% done.Report any bugs with the report verb."
CName
var/charactername = input("What's your name.","Character Name?")
if(charactername=="")
alert("You must enter a name")
goto CName
else
charactername = charactername
switch(input("What race do you wat to be?.","Character Race?") in list("Dragon","Frog"))

if ("Dragon")
switch(alert("Are you sure?",,"Yes","No"))
if("Yes")
character = new /mob/characters/Dragon()
if("No")
return
if ("Frog")
switch(alert("Are you sure?",,"Yes","No"))
if("Yes")
character = new /mob/characters/Frog()
if("No")
return


src.client.mob = character
del(src)
..()
mob
Logout()
if(istype(src,/mob/create_character))
return
world<<"[src] has logged out."
for(var/mob/M in world)
if(M.key==src.name)
M.loc=locate(M.lx,M.ly,M.lz)
del(src)

This is the login also when I log in it says logged out..
The F["mob"]>>src.client.mob in the login is the problem.

Any idea's?
Ok, first of all, you need ..() in a Login() proc unless you're TRYING to overwrite DM's default. Second, you don't need Write(F) in save(). Third, you're directing the saving in a very innefficient way. While the src is always going to be a mob, you're saving client.mob and therefore directing it to the client and then directing it back to the mob. FINALLY, you should never put "usr" in procs unless it's absolutely necessary. The usr isn't by default equal to the src because the usr is just the last mob to do something.


mob/var/saved = 0
mob/verb/save()
src<<"Saving.."
lx=x
ly=y
lz=z
var/savefile/F = new("players/[src.ckey].sav")
F["mob"]<<src
src<<"Save complete."


mob/create_character
var/mob/characters/character
Login()
..()//You need this in order to prevent overriding the built-in Login() proc.
if(fexists("players/[src.ckey].sav"))
var/savefile/F = new("players/[src.ckey].sav")
var/tmp/hash//If there's no has, then we know that there must be nothing in the savefile
F["mob"] >> hash
if(hash&&src)//Check to see if there IS a has and check to see if src is still there.
F["mob"]>>src//See the save() verb for reasons.
loc=locate(lx,ly,lz)
world <<"<b>[src] has logged in</b>"//Always end your HTML tags.
src<<"<font color=red>We are in need of a name, but the game is only 4% done. Report any bugs with the report verb.</font color=red>"
else goto NoSavefile
else
NoSavefile
world <<"<b>[src] has logged in</b>"
src.New1=1
src<<"<font color=red>We are in need of a name, but the game is only 4% done. Report any bugs with the report verb.</font color-red>"
CName
var/charactername = input("What's your name.","Character Name?")
if(charactername=="")
alert("You must enter a name")
goto CName
else
charactername = charactername
switch(input(src,"What race do you wat to be?.","Character Race?") in list("Dragon","Frog"))

if ("Dragon")
switch(alert(src,"Are you sure?",,"Yes","No"))
if("Yes")
character = new /mob/characters/Dragon()
if("No")
return
if ("Frog")
switch(alert(src,"Are you sure?",,"Yes","No"))
if("Yes")
character = new /mob/characters/Frog()
if("No")
return


client.mob = character
del(src)
..()
mob
Logout()
if(istype(src,/mob/create_character))
return
world<<"[src] has logged out."
for(var/mob/M in world)
if(M.key==src.name)
M.loc=locate(M.lx,M.ly,M.lz)
del(src)
In response to Wizkidd0123
I don't know why but bad link,unused label--NoSavefile