Need someone with spaghetti event experience

When its daytime the screen tints to sunset, at noon to normal, evening to night, midnight to dark.


Im trying to make it so that indoors it just stays normal because obviously time of day doesnt apply inside.


The pictures in the spoiler are in order, its normal inside, then i go out day night activates. but when i go back in it stays on. Ideas?


EV 002 is for entering the house and EV 001 is exiting the house.

Spoiler
bandicam 2016-02-23 16-57-13-460.jpgbandicam 2016-02-23 16-57-22-973.jpgbandicam 2016-02-23 16-57-28-341.jpgbandicam 2016-02-23 16-56-47-136.jpgbandicam 2016-02-23 16-56-54-696.jpgbandicam 2016-02-23 17-04-23-774.jpgbandicam 2016-02-23 17-04-34-988.jpg
I think you mixed up your switches - switch 002 seem to have a double function, and I hope that your day night cycle event contains some waits or it will give you some lag.
I think you mixed up your switches - switch 002 seem to have a double function, and I hope that your day night cycle event contains some waits or it will give you some lag.

I dont understand. When Switch 2 is being called in the indoor outdoor common event. it checks to see if its off or on already. Meaning if its day time itll check if the day night switch is on or off, if on itll turn off the cycle and tint the screen to normal. and the tint wont change. if off itll turn on the day night switch and resume tinting properly. And also. My day night cycle doesnt lag me so i think its okay.
Meaning if its day time itll check if the day night switch is on or off, if on itll turn off the cycle and tint the screen to normal.

No, unless you have two different switches named "Day Night ON/OFF" it does not check if it is day time - it checks itself (if the cycle is on or off, not if its day) and then changes it independently to which map you go. That might work for a time as long as every transfer goes from indoor to outdoor, but if it ever mixes up that sequence (for example if two outdoor maps are connected over it) you'll never get it sorted out. Because the way it is structured now, your event does not check if you're going in or out - it just changes the switch at each transfer.


And the problem with lag is that it is an additive bug depending on the CPU of the player. Each lagging event will use up some of the CPU reserves, until (usually later in the development) everything lags. And if you as the developer have a powerfull computer, it will not run on if a player has a much older computer.


And do you really need to check for the game hour sixty times per second? Because that is what your event does if it doesn't contain waits.
No, unless you have two different switches named "Day Night ON/OFF" it does not check if it is day time - it checks itself (if the cycle is on or off, not if its day) and then changes it independently to which map you go. That might work for a time as long as every transfer goes from indoor to outdoor, but if it ever mixes up that sequence (for example if two outdoor maps are connected over it) you'll never get it sorted out. Because the way it is structured now, your event does not check if you're going in or out - it just changes the switch at each transfer.


And the problem with lag is that it is an additive bug depending on the CPU of the player. Each lagging event will use up some of the CPU reserves, until (usually later in the development) everything lags. And if you as the developer have a powerfull computer, it will not run on if a player has a much older computer.


And do you really need to check for the game hour sixty times per second? Because that is what your event does if it doesn't contain waits.

Wow thank you. ill mess around with it some more and keep this in mind. also, i have a piece of crap super low end pc. if mines can handle. anyone can believe me lol
While Andar is right with what he said, the logic that you implemented is basically right and should work the way you expect with a minor amendment. Pleae try one of the following things:


a.) In your common event "Indoor Outdoor", insert a "Wait 1 frame" before the screen tinting


b.) In your common event "Day Night Cycle", at the top, make a conditional saying that if "Day Night" switch is off, the event processing will be exited ("Exit event processing" command)


c.) In your common event "Indoor Outdoor", double click on the tint command and take out the tick "wait for completion"


I simplified your setup and reproduced the problem. Then I dug into the RMMV and checked why it is the way it is. Believe me, the real explanation took me quite a time to find out and is rather complex. You do not really needed to understand it in depth 🙂

Spoiler
As you probably know, the RMMV works with frames which define the times how often the game is being updated per second (let's just say it's 60 frames per second [there are some corner cases]). Now, each frame, the map gets updated. This means, it redraws parts of the screen if needed, it runs the commands of parallel processes, runs the commands of an action button event you just talked to, touch events you just touched, et cetera.


Your door EV002 that leads inside is a touch event, your "Day Night Cycle" is a parallel common event. Now each frame, the map updates in such a way that first, your touch event commands will be run and after that, your parallel common event will be run. If the RMMV runs commands, it does not mean "every frame, 1 command of it is run"; instead, it rather means something like "all commands are run until a wait or something the like is hit. Then, the execution will continue the specified frames later (meaning 5 frames for a 'Wait 5 frames' command)". And at the start of the frame update, event conditions will be re-evaluated if a switch was set or something the like, so the map knows which events to run. Becoming more concrete, that means, the frame update after you touched the door leading inside will vaguely look like this:


1. Re-evaluate event conditions


2. Run commands of currently touched event EV002 (..., Transfer, Common Event Call "Indoor Outdoor", ... ), which translates in this case to: (..., Transfer, Day Night = OFF, Tint screen, wait 5 frames, ...)


3. Run commands of the parallel common event "Day Night Cycle" if its switch is set, which translates to: (Tint screen)


Let's take a look at the problem again: You stand outside and touch the door EV002 and the screen stays in its night/evening/etc. color.


With the above frame explanation, this behavior can also be explained. Touching the door means that all commands from 2 are run. This, in turn, means that the screen is correctly tinted and that your Day Night switch is turned off. But after that, the parallel common event "Day Night Cycle" will be run (3) and tint the screen the the night/evening/etc. color again before you can see the normal tint - but why? Although you set your switch Day Night to OFF, the event conditions are not re-evaluated, since this is done at the beginning of each frame in 1. So a re-evaluation of the conditions is needed before the normal tinting should be applied. Since this happens at the beginning of each frame, the solution is to wait 1 frame before tinting the screen again, like stated in a.).


The other solution b.) works because when the common event "Day Night Cycle" is run and it checks the "Day Night" switch, it directly sees the current value of the switch. c.) is a bit of a hack - it works because after the commands of a touched event are fully run, meaning that the event processing is done, all other events' conditions are re-evaluated.
While Andar is right with what he said, the logic that you implemented is basically right and should work the way you expect with a minor amendment. Pleae try one of the following things:


a.) In your common event "Indoor Outdoor", insert a "Wait 1 frame" before the screen tinting


b.) In your common event "Day Night Cycle", at the top, make a conditional saying that if "Day Night" switch is off, the event processing will be exited ("Exit event processing" command)


c.) In your common event "Indoor Outdoor", double click on the tint command and take out the tick "wait for completion"


I simplified your setup and reproduced the problem. Then I dug into the RMMV and checked why it is the way it is. Believe me, the real explanation took me quite a time to find out and is rather complex. You do not really needed to understand it in depth 🙂

Spoiler
As you probably know, the RMMV works with frames which define the times how often the game is being updated per second (let's just say it's 60 frames per second [there are some corner cases]). Now, each frame, the map gets updated. This means, it redraws parts of the screen if needed, it runs the commands of parallel processes, runs the commands of an action button event you just talked to, touch events you just touched, et cetera.


Your door EV002 that leads inside is a touch event, your "Day Night Cycle" is a parallel common event. Now each frame, the map updates in such a way that first, your touch event commands will be run and after that, your parallel common event will be run. If the RMMV runs commands, it does not mean "every frame, 1 command of it is run"; instead, it rather means something like "all commands are run until a wait or something the like is hit. Then, the execution will continue the specified frames later (meaning 5 frames for a 'Wait 5 frames' command)". And at the start of the frame update, event conditions will be re-evaluated if a switch was set or something the like, so the map knows which events to run. Becoming more concrete, that means, the frame update after you touched the door leading inside will vaguely look like this:


1. Re-evaluate event conditions


2. Run commands of currently touched event EV002 (..., Transfer, Common Event Call "Indoor Outdoor", ... ), which translates in this case to: (..., Transfer, Day Night = OFF, Tint screen, wait 5 frames, ...)


3. Run commands of the parallel common event "Day Night Cycle" if its switch is set, which translates to: (Tint screen)


Let's take a look at the problem again: You stand outside and touch the door EV002 and the screen stays in its night/evening/etc. color.


With the above frame explanation, this behavior can also be explained. Touching the door means that all commands from 2 are run. This, in turn, means that the screen is correctly tinted and that your Day Night switch is turned off. But after that, the parallel common event "Day Night Cycle" will be run (3) and tint the screen the the night/evening/etc. color again before you can see the normal tint - but why? Although you set your switch Day Night to OFF, the event conditions are not re-evaluated, since this is done at the beginning of each frame in 1. So a re-evaluation of the conditions is needed before the normal tinting should be applied. Since this happens at the beginning of each frame, the solution is to wait 1 frame before tinting the screen again, like stated in a.).


The other solution b.) works because when the common event "Day Night Cycle" is run and it checks the "Day Night" switch, it directly sees the current value of the switch. c.) is a bit of a hack - it works because after the commands of a touched event are fully run, meaning that the event processing is done, all other events' conditions are re-evaluated.

Wow. you really helped me understand this so much more.  thanks so  much i got it working! Know that you are the reason i can keep on with the game im dedicated to. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/need-someone-with-spaghetti-event-experience.57408/