ID:157855
 
I have a code, and i have declared a variable number, value 100. Then, i define other variable, with var1 inside, but ocurred an error:
Lessons.dm:17:error: maxlife: invalid variable
Lessons.dm:17:error: =: expected a constant expression
        maxlife = 100
life = src.maxlife


Other Strange, i have a string:
        clan_name = "[clan] [name]"

But other error!
Lessons.dm:23:error: clan: invalid variable
Lessons.dm:23:error: =: expected a constant expression

and is the same first error... Please Help Me!
You'll have to show us where you defined these variables.
In response to Maximus_Alex2003
Here are!
mob
icon = 'player.dmi'
name = "Naruto"
Login()
loc = locate(5,5,1)
..()
var
maxlife = 100
life = 100
equip = null
clan = "Uzumaki"
clan_name = "[clan] [name]"
In response to Twinsen99
mob
icon = 'player.dmi'
name = "Naruto"
var
maxlife = 100
life = 100
equip = null
clan = "Uzumaki"
clan_name
Login()
..()
loc = locate(5,5,1)
clan_name = "[clan] [name]"
In response to Maximus_Alex2003
But i want to know how to use the value of a variable in other...
In response to Twinsen99
By changing the second variable whenever the first variable changes. There's no way to have a variable that is automatically a function of another variable.

Another option is to just make a proc and use that. For example:

mob
var
life = 1
proc
double_life()
return life*2
In regards to this one...

    maxlife = 100
life = src.maxlife


Here is one method which might work...
mob
monster
var
maxlife = 100
life
New()
life = maxlife; // When the monster is created, init it's life.
..()


ts