Cannot modify null. in Developer Help
|
|
I'm getting the 'Cannot modify null.var. However, the output I'm getting makes no sense what-so-ever to me.
LoadPlayer(mob/M) var/ savefile/S = new("players/[copytext(M.client.ckey, 1, 1)]/[M.client.ckey].sav") mob/live/player/P temp_x = 0 temp_y = 0 temp_z = 0
S["player"] >> P S["x"] >> temp_x S["y"] >> temp_y S["z"] >> temp_z P.loc = locate(temp_x, temp_y, temp_z) if(M.client == null) world << "GAH!" M.client.KeyHandler = null M.client.mob = P sleep(1) del(M)
|
The LoadPlayer proc is defined under /mob/live/loginMob/proc. The following is the runtime error:
runtime error: Cannot modify null.KeyHandler. proc name: LoadPlayer (/mob/live/loginMob/proc/LoadPlayer) usr: Nova2000 (/mob/live/loginMob) src: Nova2000 (/mob/live/loginMob) call stack: Nova2000 (/mob/live/loginMob): LoadPlayer(Nova2000 (/mob/live/loginMob)) Nova2000 (/mob/live/loginMob): MainMenu(Nova2000 (/mob/live/loginMob)) Nova2000 (/mob/live/loginMob): Login() Nova2000 logs in. GAH!
|
The last two lines are world << "" lines. What gets me is that GAH is occurring _after_ the "x logs in" part. The "x logs in" string occurs in /mob/live/player/Login(), and since the client is connected to that _after_ "GAH" /should/ be written..., why is "GAH" coming out the tube second?
But more importantly: What on earth causes the 'can't modify null.KeyHandler' (/client/var/proc/KeyHandler) error? As has been shown by the runtime error, M is perfectly valid, and points to me. I am not doing anything radical like logging off, so why should I become null?
Once again, I'm baffled. Thanks for any help in advance.
|
Does the P mob have its ckey or key variables set to your key? If so, BYOND automatically logs you in to that mob, and out from your current one.