ID:146530
 
I have taken out the 0 and this is the set of errors i get now

The errors are

attacks2.dm:22:error:givePL:undefined var
attacks2.dm:23:error:givePL:undefined var
attacks2.dm:9:error:cookie:undefined var
attacks2.dm:9:error:givePL :duplicate definition
attacks2.dm:12:error:givePL :previous definition
attacks2.dm:9:error:= :expected a constant expression
attacks2.dm:22:error:usr/:/maxPL:undefined var

and On Lines below i have

Lines 22
            usr:maxPL += abs(givePL)


Line 23
            usr << "That cookie gave you [num2text(givePL,30)] PL! Yum!"


Line 9
        var/givePL =    cookie

Line 12

        var/givePL = 0 //var to hold how much PL the eater gets


Ok. The root of the problem seems to be that you've tried to define givePL with a variable (cookie) which wont work. You can only set a variable to a constant when defining it outside of a proc.

The usr:maxPL error is probably caused by maxPL being defined for all mobs. Try using . instead of : and it should clear up.


On line 9 and line 12 you've defined givePL. Now I'm guessing what has happened is you've got something like this:
obj
cookie
var/givePL = cookie
badCookie
var/givePL = 0


Now what's wrong here is badCookie already has a givePL var, so you don't need to define it again. You just need to override the default setting.
So the following would work (appart from that error with cookie we discussed before):
obj
cookie
var/givePL = cookie
badCookie
givePL = 0
In response to DarkView
This is the exact coding ihave


cookie
icon = 'miscobjs2.dmi'
icon_state = "cookie"
var/givePL = cookie
icon = 'miscobjs2.dmi'
icon_state = "cookie"
var/givePL = 0 //var to hold how much PL the eater gets
var/cookieName //var to hold the name of the person you're eating

mob
verb
Eat()
set src in oview(1)
set category = "Commands"
var/cookieName //var to hold the name of the person you're eating
usr << "You eat a [cookieName]© brand cookie!"
usr:maxPL2 += abs(givePL)
usr << "That cookie gave you [num2text(givePL,30)] PL! Yum!"
del(src)//var to hold how much PL the eater gets


I hope this helps
In response to Govegtos
You have 'givePL' defined twice, one which is being set to a variable outside a proc (var/givePL = cookie).

You should never use the colon operator in place of a period, especially if your using it after usr within a verb.