[RMXP] Conditional Branch Script

Good morning, I'm trying to create a Conditional Branch Script, but it gives me an error or it doesn't work.

I want that when the result is equal to a number, it changes the value of a variable control to the one I indicate.

I have done this, but it doesn't work.

if (result == 0)
$gameVariables.value(26) = 0

end
if (result == 1)
$gameVariables.value(26) = 1

end
if (result == 2)
$gameVariables.value(26) = 2

end

or I did this too

1666278734830.png
$game_variables[26] = NUMBER

I suggest you read tutorials on RGSS scripting.

Scripts in conditional branches do not need the "if" keyword. You also can't use local variables outside of it either, i.e. variable "result" in your Script Call cannot be referenced in your conditional branch.
Just replace the result variable with a @result instance variable and you will be able to keep the value (if needed). Once you no longer need it, you can set its value to nil like this: @result = nil

Original thread: https://forums.rpgmakerweb.com/threads/rmxp-conditional-branch-script.152101/