Variable issue

Hello, i have trouble using script for variable edit.
I want my variable C being reduce by a variable B, But the variable C depend of an other Variable A.
So i made this script. It didn't work.

$gameVariables.setValue($gameVariables.value(A)) == ($gameVariables.value($gameVariables.value(A)) - $gameVariables.value( B )
edit: I also tried

$gameVariables.setValue($gameVariables.value(A), ($gameVariables.value($gameVariables.value(A)) - $gameVariables.value( B ))

The first code make the value of variable

Thanks for help.
Your script command is wrong.

To set a variable, you need two numbers for which variable to set and which value to set, but your code only contains the value
Well...
2 point, first it is still better to tell what i should do.
Second, i do have part who are a value. In the first it is the "==" , in the second it is the "," who make the separation.
First, == is a comparison and not an assignment, you can't set a variable with that.

Second, the setvalue function needs two arguments inside its (), one for the variable ID and the other for the value that you want to set - the part you placed behindert the == where it is absolutely useless.

The second Version can work if it is used correctly, the first with == can never work.
However, it uses the value stored in the variable A as the ID of the variable where you want to store the new data, is that really what you want?
Because your description reads as if you want to store in the variable A, and that is not what you did in the second version.
Basically, i need to reduce variable C who is related to Variable A , the reduction variable is B. In other formula i want , (C(=A)) = ((C(=A)) - B )
OK; so i fixed it by doing it in an other way. Thanks for help^^
(I changed how i manage it by reducing the variable before)
If C is really just set to whatever A is, this should be the equivalent of the result you want:

$gameVariables.setValue(C, ($gameVariables.value(A) - $gameVariables.value(😎) );



The following is a longer way of doing mathematically the same thing:

$gameVariables.setValue( C, gameVariables.value(A) ); //changes C to A
$gameVariables.setValue( C, (gameVariables.value(C) - gameVariables.value(😎) ); //reduces C by B

With A, B, and C being the ID numbers of the variables of course.


*edit* Sorry, '.value( B )' gets changed to an emoticon, rather annoyingly.

Original thread: https://forums.rpgmakerweb.com/threads/variable-issue.86099/