How to write an If : Script : Variable = "word"

I would like to set up a conditional branch that checks if a variable is equal to a specific word instead of a number or variable.  Something like this:


If : Script : $GameVariables.value(1) = "word"


Is it possible to do this?  And if so - would someone write me an example so I can correct the syntax?
Here is the easiest way I have found.


Make a dummy variable that would be equal to your "Word"


Then when you are ready to do a conditional branch you will check if Variable(1) = DummyVariable


In this example Word would be Variable(1) and Word2 would be DummyVariable.


I hope this helps, as I am not very good with java script.

Untitled.png
Here is the easiest way I have found.


Make a dummy variable that would be equal to your "Word"


Then when you are ready to do a conditional branch you will check if Variable(1) = DummyVariable


In this example Word would be Variable(1) and Word2 would be DummyVariable.


I hope this helps, as I am not very good with java script.


View attachment 29547



Thank you for your reply DOTCrepper.


I was hoping there was a way I could avoid having to create a dummy variable using scripts directly.  But there may not be.  Because using a dummy variable would mean I'll have to create new variables for what would essentially be the same purpose.


For an example, on my game the player may equip a single skill at any one time to learn per class. So I set a variable to equal the "name of skill".


It would be convenient if I could use that same variable in a conditional branch instead of having to make new ones.
How about this




(Image still seems small...)
You almost had it the first time.

Code:
Conditional Branch: Script: $gameVariables.value(1) == "word"

= is for assignment


== is for comparison


and $gameVariables is the correct case
You almost had it the first time.

Code:
Conditional Branch: Script: $gameVariables.value(1) == "word"

= is for assignment


== is for comparison


and $gameVariables is the correct case



That worked perfectly.  As always Shaz, appreciate the help.


I would mark this as solved but in this new format I'm unclear on how to do it.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-write-an-if-script-variable-word.55520/