ID:147140
 
Yo, i'm having a problem with a start screen login code/

the New character part is just fine, its just every time I click load to load the
saved character it comes up with an error. here is the code thats the problem.
mob
Login()
usr.loc = locate(5,5,2)
..()

mob
var
Health
MaxHealth
Class
Exp
ExpNeed
mob
proc
CreateChar(mob/M)
sleep(20)
world << " \blue [usr] has logged on."
alert("Night Wings of the Fallen Ones.","Welcome","Ok")
src.name = input("What would you like to be known as?","Name",src.key)
var/a = input("Choose Your Character")in list("Dark")
if(a=="Dark")
usr.icon = 'mob.dmi'
usr.icon_state = "main"
usr.Health = 25
usr.MaxHealth = 25
usr.Class = "Dark"
usr.Exp = 0
usr.ExpNeed = 30
usr.loc = locate(7,7,1)



SaveChar()
var/savefile/F = new("players/[src.ckey].sav")
var/X,Y,Z
F["name"] << name
F["X"] << X
F["Y"] << Y
F["Z"] << Z
F["mob"] << usr.client.mob

verb
Save()
usr.SaveChar()
usr << "Your character has been saved."

turf/Background
icon = 'Logo.bmp'
name = ""
density = 1
layer = MOB_LAYER+1

turf/nomove
density = 1

turf/NewChar
icon = 'New.bmp'
name = "New"
layer = MOB_LAYER+1
Click()
if(fexists("players/[usr.ckey].sav"))
switch(alert("If you continue with a new character, your previous character will be erased. Do you wish to continue?","[world.name]","Yes","No"))
if ("Yes")
usr << "... Ok... You can now create a new character."
usr.CreateChar()
return ..()
if ("No")
usr << "Ok, Please reconnect for you are being disconnected now and then choose \"LOAD GAME\""
del(usr)
return ..()
else
usr.CreateChar()
return ..()
..()


turf/LoadChar
icon = 'Load.bmp'
name = "Load"
layer = MOB_LAYER+1
Click()
if(fexists("players/[usr.ckey].sav"))
usr.LoadCharacter()
usr << "Welcome back!"
return ..()
else
alert("You don't HAVE an old character here, or it isn't found in our databases!")
return ..()
..()

mob
proc
LoadCharacter()
var/savefile/F
var/X,Y,Z
F = new ("players/[src.ckey]")
F["name"] >> name
F["mob"] >> src
F["x"] >> X
F["y"] >> Y
F["z"] >> Z
src.loc = locate(X,Y,Z)
List your Errors.
In response to Hell Ramen
There isn't an error in the Dream maker, the error is in the Dream Seeker when the Load button is clicked

it says thiswhen the load button is clicked
<font color="red>
runtime error: Cannot modify null.loc.
proc name: LoadCharacter (/mob/proc/LoadCharacter)
source file: login.dm,102
usr: (/mob)
src: null
call stack:
LoadCharacter()
Load (9,3,30) (/turf/LoadChar): Click(Load (9,3,30)(/turf/LoadChar))
</font>
In response to ElderKain
turf/NewChar
icon = 'New.bmp'
name = "New"
layer = MOB_LAYER+1
Click()
var/mob/other/choosing_character/M = usr //replace /mob/other/choosing_character with whatever your world.mob is set to
if(fexists("players/[M.ckey].sav"))
switch(alert(M,"If you continue with a new character, your previous character will be erased. Do you wish to continue?","[world.name]","Yes","No"))
if ("Yes")
M << "... Ok... You can now create a new character."
M.CreateChar()
return ..()
if ("No")
M << "Ok, Please reconnect for you are being disconnected now and then choose \"LOAD GAME\""
del(M)
return ..()
else
M.CreateChar()
return ..()
..()


turf/LoadChar
icon = 'Load.bmp'
name = "Load"
layer = MOB_LAYER+1
Click()
var/mob/other/choosing_character/M = usr //replace /mob/other/choosing_character with whatever your world.mob is set to
if(fexists("players/[M.ckey].sav"))
M.LoadCharacter()
M << "Welcome back!"
return ..()
else
alert(M,"You don't HAVE an old character here, or it isn't found in our databases!")
return ..()
..()


Hopefully this modified version works >_>
In response to GhostAnime
GhostAnime, Thats ok and all but when i click compile it comes up with this warning

login.dm:62:error:M.ckey:undefined type: M.ckey
login.dm:63:error:M:undefined type: M
login.dm:65:error:M:undefined type: M
login.dm:66:error:M.CreateChar:undefined type: M.CreateChar
login.dm:69:error:M:undefined type: M
login.dm:70:error:M:undefined type: M
login.dm:73:error:M.CreateChar:undefined type: M.CreateChar
login.dm:84:error:M.ckey:undefined type: M.ckey
login.dm:85:error:M.LoadCharacter:undefined type: M.LoadCharacter
login.dm:86:error:M:undefined type: M
login.dm:89:error:M:undefined type: M
login.dm:83:M :warning: variable defined but not used
login.dm:61:M :warning: variable defined but not used
In response to ElderKain
"Dont put usr in procs Ungh" - Lummox Jr


--Goz
In response to Goz
Goz wrote:
"Dont put usr in procs Ungh" - Lummox Jr

--Goz

well i changed the usr to src in the procs but still no change, that didn't help, sorry.
In response to Goz
Goz wrote:
"Dont put usr in procs Ungh" - Lummox Jr

No butcher well-known quote (or name). Ungh.

Lummox JR