ID:140462
 
Code:
mob
var
damage
strength
agility
Chars
HumanMale
damage = strength / 5 + agility / 5


Problem description:
when i try to compile i get 3 errors

Thornvaile.dm:113:error: strength: invalid variable
Thornvaile.dm:113:error: agility: invalid variable
Thornvaile.dm:113:error: : expected a constant expression

this is because of my formatting i assume, ive read through the guide and reference and 1 or 2 tutorials but im not sure what im doing wrong, any corrections would be appreciated.
You cannot set a variable to be a function of some other variables. To do what you want, you need to either update the damage variable every time you change either of the two other variables, or you just need to put that formula into a proc like so:

mob/proc/calc_damage()
return agility/5 + strength/5
In response to Garthor
okay, was hoping i wouldnt have to update the var but thanks.
In response to Netmanx
You may just consider setting damage at the time it is used. ex: a variable inside of a proc or verb, instead of using a proc to dynamically update the characters damage.

It really just depends on how you setup you game as to which method would be more efficient.
In response to Jotdaniel
thanks for the suggestion, but with the way my game works ill need it to be updated right after it changes which can be quite frequent and in many different occassions