Help with variables

So, in my game I want to make it so that every time a certain switch is turned on, the value of a variable increases by 1. Does anyone know how to do this? I've tried and I haven't gotten far. Thanks. 🙂

EDIT: Oh, forgot to mention originally that I'm looking to find a way to make a variable still be increased from when the switch was on, even if it's off.
With a conditional branch you can do that easily. Simply create a conditional branch like this:
Spoiler: CB
38552-303d98c7be234e9a0f05677fb46d4ba2.jpg


this way when that switch timer is on, the variable Car will increase by 1 (this is just an example)

Then it depends much on what you intend to do. If you want this in an event with parallel process you need to create another switch or self-switch so it will not be constantly adding 1 to that variable since said switch will still be on.

Hope this helps and someone correct me if I am wrong XD
Yea, I've been trying this, and it hasn't worked; If you use the \v[n] command in a text box, it will tell you the value of a variable, and all it says for me is 0. I probably should've mentioned this earlier, but I'm looking to find a way to make a variable still be increased from when the switch was on, even if it's off. Thanks for trying to help, though!
It might be better to explain what it is you're trying to do, rather than how you're trying to do it. What is this supposed to accomplish?
Could you explain a little more, please? Or maybe a screenshot of your actual event?
Because I don't understand what you are trying to do or how...
Sure, sorry for the confusion.

I'm trying to make it where the player goes to "sleep", and each time they do at the end of the day, a switch turns on, and I'm trying to make it so that when that switch is on, the value of the variable I have labeled "days" increases by 1. Hope that helps.

EDIT: Oh, and the switch sleep turns off by the next day.
Sure, sorry for the confusion.

I'm trying to make it where the player goes to "sleep", and each time they do at the end of the day, a switch turns on, and I'm trying to make it so that when that switch is on, the value of the variable I have labeled "days" increases by 1. Hope that helps.

EDIT: Oh, and the switch sleep turns off by the next day.
So I'm working on a game where every night the player goes to sleep they end up in a dream world, then when they wake up it counts the day up, if they return to the house the switch is still on because they haven't gone back to sleep so it doesn't trigger every time they walk in the room until they sleep and wake up again. It sounds like my 3 events may be helpful so I'll post them up for you.

Spoiler: Sleep
Sleep_zpsncye1y8o.png
Spoiler: WakeUp
Wake%20up_zps7pozghup.png
Spoiler: DisplayDay
Display%20Day_zpsuzvprv79.png
Yea, I've been trying this, and it hasn't worked; If you use the \v[n] command in a text box, it will tell you the value of a variable, and all it says for me is 0.
Then you made a mistake in your events somewhere.
The example to which you answered WILL work, and if it doesn't for you then something in your event was done in the wrong way.
Please post a screenshot of your event page(s) and we can tell you where you made your mistake.
It sounds like my 3 events may be helpful so I'll post them up for you.
Hm, I could do something like the wake up one, if I can't get this to work. Thanks!

Please post a screenshot of your event page(s)
Ok, here's the two events that I'm using.
Spoiler: Events
Event 2.png
Event.png
That event won't run just because you turned on that switch 😛 there is no condition for it to run if that switch is on - see the left side of the event screen? You would need to select that switch of yours there, and then set the event to autorun, and don't forget to turn it off either, since it'll loop with an autorun.

In fact, why does it need to be a separate event in the first place? You can simply .. fade the screen, add +1 to variable Days, and fade the screen back in - no need for a switch either.

But if you're trying to do a day & night system, then I suggest using common events for this. Create a new common event, call it "New Day" or whatever. In this common event, add in everything you want to happen when the player has gone to sleep (don't add in a fade!), such as increasing the variable Days.

Then, in the event that asks if you want to sleep, and the player selects yes, fade out the screen, and call common event New Day, fade the screen back in. Tada ~ a new day, and you can always go back to your common event and edit it with new stuff, and the sleep event does not need to be edited.

Mostly though, you need some beginner guides!
Yes, like Celianna said, the event does not process because the trigger you have doesn't allow it. You need to check the triggers, and be sure that they will activate accordingly with your needs. So, if it is action button, it will only start if the player activates it. I also agree with Celianna, you don't need to have another event for this one, you can add it in the current event of sleeping. And that would even prevent the need of creating the switch sleep, because it wouldn't do anything. Which saves you a switch for another thing!
https://forums.rpgmakerweb.com/index.php?threads/conditions-triggers-and-event-pages.15098/
Check out this tutorial of GrandaDeb, it's great to learn new things, even if you think you know it already. And if you do, think of it as a little study!
http://blog.rpgmakerweb.com/tutorials/understanding-common-events/
This one is about common events, like Celianna suggested, a common event is the best way to go.
Hope this helps you somehow...
Oh, I see what I was doing wrong. Thanks a bunch for helping me, guys!!! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/help-with-variables.76065/