Checking if a switch is ON in a script

LazESigma

Veteran
Veteran
Joined
Nov 9, 2013
Messages
50
Reaction score
2
First Language
English
Primarily Uses
Very surprised I haven't see this question yet.
I've mostly seen the answer to how to use SetValue in a script to set a switch to true or false.

I want to check if my switch (ID = 269) is ON.

This doesn't seem to work.

if ($gameSwitches.Value[269])
{
//code if switch 269 is ON
}

What is the correct way write an IF command using the $gameSwitches?
Thanks!
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
PHP:
$gameSwitches.value(269)
You'll find that value is a function, not an array/object. Also value needs to be lowercase. Your thing is returning undefined.

I just learned that using the console to auto type it.

Don't worry. It happens to the best of us.
 

LazESigma

Veteran
Veteran
Joined
Nov 9, 2013
Messages
50
Reaction score
2
First Language
English
Primarily Uses
Thanks mogwai, that is indeed the case. :)
//facepalm
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top