Using Scripts in IF statments (Conditional Branches).

How do i use a script in a Conditional Branch?

I tired a few different things but my JS is far to rusty.

The pictured section is in a yellow box is my latest attempt.


Thanks.

if script question.png
Conditions retrieve values, they don't set them. At least in Ace, whenever you set a switch, the value returned was ALWAYS true, because setting the switch succeeded.

Code:
Conditional Branch: Script: $gameSwitches.value($gameVariables.value(10))
would be true if the switch was true, and false if the switch was false. The switch number is taken from variable 10.
Is it possible to do  the following as a script inside the conditonal branch

If Switch (var10) is off
$gameSwitches.value($gameVariables.value(10), false)
actually I can make that work by reversing the then and else parts of the statement.
thanks for your help again Shaz.
You would not do that in a conditional branch. If you wanted to use a script to set a switch, you would use a Script event command (second last command on tab 3)

Original thread: https://forums.rpgmakerweb.com/threads/using-scripts-in-if-statments-conditional-branches.49248/