ID:145465
 
Code: Eat proc. Nice and simple.
obj
var
fatt = 8
fill = 1
Food

verb
Give_to(mob/M)
if(M.fishtype)
usr << "You give [M] a [src]."
src.loc = M.loc
M.Eat(src)
else
usr << "[M] is not a fish!"
mob
proc
Eat(mob/Fish/M,obj/Food/F)
if(F.fatt >= 1)
M.fat += F.fill
F.fatt -= 1
M.hunger -= F.fatt
if(M.hunger <= 0)
M.hunger = 0
return
sleep(4)
Eat(M)
else
del(src)


Problem description:

runtime error: Cannot read null.fatt
proc name: Eat (/mob/proc/Eat)
usr: RedlineM203 (/mob/Player)
src: Redline (/mob/Fish/)
call stack:
Redline (/mob/Fish/): Eat(Shark (/obj/Food/Shark), null)
Shark (/obj/Food/Shark): Give to(Redline (/mob/Fish/))

I'm stumped.

The problem is your Eat proc is twisted up a bit. When you call the proc, you call it with M.Eat(src), which is only supplying one argument through to Eat(). In your Eat proc, it has 2 arguments to watch for, mob/Fish/M and obj/food/F.

The proc you made is a mob proc, so the fish should be the one running the proc. You got that right, with M.Eat(src).

But then in your Eat() proc, its looking for mob/Fish/M and obj/food/F, but all it's getting is the food in place of M. Understand?

Technically, you don't need mob/Fish/M at all, since the fish is running the proc, it makes the fish src. So it would look something like this:
mob/proc/Eat(obj/Food/F)
if(F.fatt >=1)
src.fat+=F.fill
//etc, etc


Hope that helps.
In response to Detnom
Hey detnom, it's been awhile.