Using Scripts in IF statments (Conditional Branches).

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
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
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,789
Reaction score
15,915
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
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)
 

Lordkazar

Villager
Member
Joined
Dec 23, 2013
Messages
24
Reaction score
1
First Language
English
Primarily Uses
actually I can make that work by reversing the then and else parts of the statement.
thanks for your help again Shaz.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,789
Reaction score
15,915
First Language
English
Primarily Uses
RMMV
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)
 

Latest Threads

Latest Profile Posts

1660090657213.png
Mistakes will be made.
After three years, it was awesome to be back at Gen Con!
Words of Wisdom: You can be honest and alone. Or dishonest and together.
Working on mapping using RPGTools to create parallax maps using PVgames tiles/assets. It's super cool... but mapping is still something I drag my feet on getting done. I hate this but love the math parts of design, which is the opposite of a lot of dev's around, I think. It really do be different strokes for different folks.
Spend $5,000 on a new gaming PC. Didn't expect it to be like 1 foot wide, 2 feet tall, and weigh like 100+ pounds. The heck did I get myself into?

Forum statistics

Threads
124,379
Messages
1,163,210
Members
163,179
Latest member
LeuzyGamer
Top