mob/var
restingreiatsu = round(src.reiatsu/2)
Problem description:
So I suppose that you can't have a variable in a variable... yeah >_>.
I was curious as how I might make a variable that equals out to 1/2 the src's reiatsu.
ID:142997
Jan 17 2008, 2:19 am
|
|
Code:
mob/var Problem description: So I suppose that you can't have a variable in a variable... yeah >_>. I was curious as how I might make a variable that equals out to 1/2 the src's reiatsu. |
In response to Kaioken
|
|
So there's no way to make this variable?
See, there are three variables that I'm working with. Reiatsu, Resting Reiatsu, and Max Reiatsu (basically MP). The resting reiatsu would be 1/2 of a person's max reiatsu (I know, that's now how I coded it, but I was just trying to see if something like that would work), and it's what a person would be normally without releasing their max reiatsu. Is there no way to do the whole 1/2 max reiatsu thing? |
In response to GohanIdz
|
|
Whenever you change the other variable, change this variable to what you want it to be.
|
You cannot set a variable at compile-time to a non-constant value; basically, you can't set it to anything that requires most calculations or operations to run, including checking the value of a different variable. Operations can only be done in a proc (or verb, but that is a special type of procs); except some that produce constant values, like 1+2 or 1/2.
That means you cannot use round() neither can you use src.reiatsu. Of course, there isn't a 'src' in your code block anyway in the first place.
If you want to initialize an object variable to a non-constant value, you can just do it as soon as the object is created; for other variables (global ones), do it when the world is created. In other words, do it in the respective New() proc.