Variable in a formula from a plugin?

Hi ;0


I'm not sure how I would ask this, but here goes.


I'm using a formula for my encounter steps, but I cannot seem to know how I can set a number based on a variable.


Example: ((Math.randomInt(encounterStep) + Math.randomInt(encounterStep)) / 2) * (($gameVariables.53 / 10) + 1) + $gameVariables.52


What would I need to change?


Thanks and please post anything that could help me solve this problem!
use $gameVariables.value(x) where x is the variable


to set one, use $gameVariables.setValue(x, y) where x is the variable and y is the value
So with this, it should replace the variable #53 by it's current number, right?
if you use $gameVariables.value(53)  in a call, like in the one up above for example, then it's using the value in that variable as the number for the calculation. 


so if I did $gameVariables.setValue(1, $gameVariables.value(2) + 1)


if variable 1 started as 0, and variable 2 was '5' before the calculation, then variable 1 would wind up being 6. 


.setValue asks for 2 arguments, the first being the variable, the second being the assignment. As you can see, you can do the math right inside of the argument like I did in the example above. 


.value is just passing value of the variable in the argument in place of the call. So if variable 2 has a value of 6, $gameVariables.value(2) is like saying '6'. 


I really hope this clears it up

Original thread: https://forums.rpgmakerweb.com/threads/variable-in-a-formula-from-a-plugin.60160/