Formula variables is the term I use for any "special variables" that can be used in a formula.
I wrote a brief summary about it here
http://www.himeworks.com/2013/06/04/rgss-formula-variables/
Basically, it's things like in a damage formula, a is the user, b is the target, and v are the game variables.
Currently, all of my scripts hardcode the formula variables into method signatures, and it is impossible to add new variables without basically overwriting the method.
For example, consider the damage formula eval method
def eval(a, b, v=$game_variables) # logicendHow can it be written so that I can easily inject new parameters with default values?For example, I can overwrite the method as this
def eval(a, b, v=$game_variables, s=$game_switches, p=$game_party, t=$game_troop) # logicendBut if you wanted to add one yourself, you wouldn't be able to do it without overwriting my change.At this point, I'm thinking it is not possible given how methods and parameters work, but maybe there's some trick that ruby has that will allow us to accomplish this.
I wrote a brief summary about it here
http://www.himeworks.com/2013/06/04/rgss-formula-variables/
Basically, it's things like in a damage formula, a is the user, b is the target, and v are the game variables.
Currently, all of my scripts hardcode the formula variables into method signatures, and it is impossible to add new variables without basically overwriting the method.
For example, consider the damage formula eval method
def eval(a, b, v=$game_variables) # logicendHow can it be written so that I can easily inject new parameters with default values?For example, I can overwrite the method as this
def eval(a, b, v=$game_variables, s=$game_switches, p=$game_party, t=$game_troop) # logicendBut if you wanted to add one yourself, you wouldn't be able to do it without overwriting my change.At this point, I'm thinking it is not possible given how methods and parameters work, but maybe there's some trick that ruby has that will allow us to accomplish this.
Last edited by a moderator:

