ID:525270
 
Keywords: help, hp, problem
(See the best response by A.T.H.K.)
Code:
proc
setHP()
if (src:CHP >= src:MHP)
set src:CHP = src:MHP


Problem description:
(CHP is current HP; MHP is max HP.) So, I made this little line of code because I didn't want a mob's current HP to be higher than it's max HP (For obvious reasons). So, I revised this a few times, but every time I try to compile, it says: mobs.dm:36:error: src/:/CHP: can't assign to left-hand side
Can anyone help me?
Also, I have another problem (minor, for now).
I have this:
verb
healme
hidden = 1
set src:CHP = src:MHP

It gives me:
mobs.dm:29:error: healme: invalid proc definition
Any help, with either of these problems, please?


That is not how to use SET

take the SET off and it'll work fine.
You are supposed to use set hidden = 1 in this instance and you should not be using colons for your variables, use a period.

Also, use usr in verbs.
In response to Neimo
Neimo wrote:
You are supposed to use set hidden = 1 in this instance and you should not be using colons for your variables, use a period.

Also, use usr in verbs.

Can't believe I missed that!
Best response
mob/verb
healme()
set hidden = 1
usr.CHP = usr.MHP


There we go!
You might wanna brush up on your knowledge of the language, too. Those are some serious issues for a very simple thing.