ID:267225
 
I have this thing in my client.North() procs. Here is an example of it.

client.North()//This overrides the default North proc
if(usr.DoingIt)
walk(usr,NORTH,5)
var/thing = rand(1,10)
if(thing <= 3)
usr.Hunger -= 1
usr.HungerCheck()
else
..()

Every step when they are "DoingIt" they take sometimes makes them a bit hungrier. But when i do the proc, it gives me this runtime error.

runtime error: Cannot read null.client
proc name: HungerCheck (/mob/proc/HungerCheck)
usr: Dragon Lord (/mob)
src: Dragon Lord (/mob)
call stack:
Dragon Lord (/mob): HungerCheck(null)
Unknown Person (/client): North()

If anybody could help me fix this, it would be appreciated. Also, the hunger var is at 100. =P

--==EDIT==--

Oops i meant this to be in Code Problems.
This is just as good a forum as any for the question. But I wonder why you didn't post the HungerCheck() proc as well, since that's where your problem is. The client/North() proc looks correct on the surface, so I'm guessing there's just a really big mistake in HungerCheck(). Generally these kinds of mistakes (cannot read null.var) are the easiest to spot.

Lummox JR
In response to Lummox JR
Here is my HungerCheck() proc...

mob/proc
HungerCheck(mob/M)
if(M.client)
if(M.Hunger <= 10)
M << "Oh boy, you are getting hungry. Go get some food."
if(M.Hunger <= 1)
M << "
You get so hungry that you faint. 911 rescues you and brings you to the lobby."
M.Hunger = 50
M.SignUp = "None"
M.Score = 0
M.Deaths = 0
M.loc = locate("Start")

I hope you can help me!
In response to Unknown Person
In your HungerCheck, there is an argument mob/M but when you call it, you leave it out. Thus, it is filled in as null, and your get you error. Try usr.HungerCheck(usr)

Heh, Lummox told me the other day about what happens when you leave out stuff to your proc. They get passed as null, and that's why you get Can't read null.client.

Also, last note, place code between DM tags, and Close your HTML tags.

-<font color="#bbffbb">Nova</font>
In response to Unknown Person
Nova hit it on the head; I actually expected that was the problem right off the bat.

You don't need the M argument in your proc at all; just replace all that with src, and take out the argument.

Lummox JR
In response to Nova2000
i think instead of using usr in your client/North() you should use mob...try that....i might just be being stupid, but try that..

--Magnus