$game_switches evaluation

I am trying to evaluate if a $game_switches[1] is set to true or false but, when I try the evaluation sets it to what I'm evaluating.

I can activate the switch from another event with the following script:
Ruby:
$game_switches[1] = true
This is on Event 1 Map 1
I need the condition switch checkbox on Map2 Event1 page 2 for it to be activated when the game switch is activated from Map1 Event 1 Map 1
If I write
Ruby:
$game_switches[1] = true ? $game_switches[1] = true : $game_switches[1] = false
to try and evaluate if the switch set on map one is true or if I put anything that says
Ruby:
$game_switches[1] = false
or
Ruby:
$game_switches[1] = true
in Map2 Event1 Page2 It doesn't matter it to evaluates as true.

Is there a way to replacing the check box with a scripted command?
'Scripts' is where people who have written a script they want to share with others can post it.

Moved to: Learning Ruby and RGSSx
@whitequill You need two equals signs to evaluate. Whenever you use one equals sign, you are setting the value.

Code:
$game_switches[1] = true
# $game_switches[1] is now equal to 'true'

$game_switches[1] == true
# returns 'true' if switch is currently true, or 'false' otherwise
$game_switches[1]
# also works as above

Here is a video explaining the quandary. Because its a little more difficult then just typing
Code:
$game_switches[1] == true

The red orb has the code
Code:
$game_switches[1] == true
in it, but it won't activate the chest unless the condition switch check box is active on page two of the chest.

I want to skip the check box and just use a script instead of the checkbox.
This is because of your event pages. Without anything to stop that event from going to page 2, it will automatically go there as this is the furthest right most page and takes priority over the 1st (or left most) page.

If you set a conditional check on Page 1 for the switch, you can use that to trigger a self switch to move to Page 2.
Spoiler: Example
example.png
This is because of your event pages. Without anything to stop that event from going to page 2, it will automatically go there as this is the furthest right most page and takes priority over the 1st (or left most) page.
From what I can tell from your post is its going to be six of one or half-a-dozen of another. Either I use game switches or self switches.

I have an example of what I have that is working.
The script on the left works as the conditional and on the right is the switch. What I want is to replace the switch with the highlighted code.
https://gyazo.com/e6cf39ebe7e1917254fd895a0c0c9d28
If I un-check the switch the highlighted code will not act as if it was a checked switch and it will be ignored.
Just give this whole thing a read (including the custom conditions script)

http://himeworks.com/2014/10/understanding-and-surpassing-event-page-limits/
What @KK20 linked is a good thing to give a read over as it explains it more in depth but basically, a page is going to need a Condition for when it plays or else it will always be the first to play in your event (if it is the right most page of the event). No checkbox in a condition means that Parallel page will always play.

Even if you put a switch check on the page itself, it doesn't need to check for it to be true to play as it has already met all it's conditions.
Why are you doing this via script at all? If you want page 2 to be activated when switch 1 is turned on, just put switch 1 in the conditions box in the top left corner of page 2.

Also, to check if a switch is true or false, just use $game_switches[1]. You don't have to compare to true or false. The switch will hold one of those values, so $game_switches[1] will return true or false all on its own, without doing any comparison at all. But again, why are you even using a script call?

Seems like you're making it far more complicated than it needs to be.

If your page 2 is not activating when that switch is turned on, then there's something else going on - either you have other conditions on that page that are not yet met, or you have a higher numbered page that has no conditions, or whose conditions are met, and that is the active page (it's always the highest numbered page that will be activated).
Why are you doing this via script at all? If you want page 2 to be activated when switch 1 is turned on, just put switch 1 in the conditions box in the top left corner of page 2.
Because I'm a programmer and I like a clean API and a bunch of pre-made symbols is good for people who don't know how to program but, I know how to program and thus would like to use Ruby because I can do more with it then if I am restricted by Enterbrain's system no matter how robust it is.

I wish there was documentation by Enterbrain for more advanced users who understand Ruby or wish to use Ruby, or if you are in MV Javascript.
An example is the self switch you can write:
Code:
$game_self_switches[[@map_id, @event_id, 'redOrb']] = FALSE
and make infinite number of self switches all named useful things as opposed to self switch A threw D.

Reference: Is it possible to make more self swtiches

Point being, you can do much much more if you know scripting then if you just rely on the predefined functions of the given UI.
I guess you could argue that all the code in the script editor that runs the game engine is "documentation" but, I feel that is kind of far fetched because it is not commented at all.
Because I'm a programmer
Well you sure fooled me with your first post.

I guess you could argue that all the code in the script editor that runs the game engine is "documentation" but, I feel that is kind of far fetched because it is not commented at all.
This is an absurd request. Have you looked at RMXP's scripts? Just about every line of code is commented, and I absolutely hate it. If you're an actual programmer, you would know that "self-documenting code" is the ideal standard, which I think VXA achieves. There's an endless amount of things you can do with the existing classses; having to explain in excruciating detail what *every little thing* does is countless of hours of work.

Remember the average user has no knowledge of how to code (that is one of the biggest principles of RPG Maker). It wasn't designed to teach you how to program. Besides, there's plenty of resources out there on how to utilize RGSS (and Ruby) to its fullest extent thanks to the community RM has garnered.

How did I get good at scripting? I played with scripts. I installed custom scripts that I liked. I tried bending some values to what I wanted. I learned new things from others by the way they solved a certain problem. I googled extensively on how to do X or understand what Y method does. I started writing my own scripts and bug fixing others to expose myself to more of the unknown. I probably only asked a couple of questions myself during my whole learning process, and they weren't really RGSS/Ruby related either (more like making DLLs and good design practices).

You
need to make that effort.
Because I'm a programmer and I like a clean API and a bunch of pre-made symbols is good for people who don't know how to program but, I know how to program and thus would like to use Ruby because I can do more with it then if I am restricted by Enterbrain's system no matter how robust it is.

Just because you can, doesn't mean you should. There are plenty of programmers here, and the majority are more than happy to use the "bunch of pre-made symbols". The ones who aren't, are the ones who want to go in a completely different direction and basically want to rewrite the entire underlying engine to behave in a completely different way.

Point being, you can do much much more if you know scripting then if you just rely on the predefined functions of the given UI.

Thing is, you are not doing "much more" - you are doing exactly the same thing that it already does.

Enterbrain has provided script calls in numerous contexts and plugins for cater for the people who feel restricted. You don't have to reinvent the wheel by rewriting the most basic stuff via script. You will be a long, long time getting anywhere making a game if you're going to do that.

I am also a programmer - for 30 years. The only time I've ever rewritten any of the code for the premade event commands is when I wanted to add extra functionality to them.

Original thread: https://forums.rpgmakerweb.com/threads/game_switches-evaluation.115560/