Wierd loading problem in Developer Help
|
|
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?
|
<DM>
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 <<"[src] has logged in"//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 <<"[src] has logged in"
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)