Ok so I recently posted about Hidden Grottos, and now I am confused about script switches, mainly switch 23. "s:cooledDown?(86400)" I understand that it is off until the 24 hour time period has ended, and know how to use it in time sensitive events.
Now, my question comes when you have 2 different time sensitive events, and both want a 24 hour cool down. Can I use the same switch 23 for both of them? I don't understand how a Global Switch could be ON and OFF at the same time for different events. I read everything on the wiki about it, and couldn't find an answer.
I am rereading this and realizing it is hard to understand... Can someone explain this?
It's not publicised, but as well as each event having a set of Self Switches, each event also has a single Self Variable. It's an Essentials feature.
You'll have seen pbSetEventTime floating around here and there in time-sensitive events. What this does is set the event's Self Variable to the current time.
One other thing to know is that the game doesn't constantly check all the events to make sure they're on the right pages. This stuff is only checked when the map is refreshed, and each event's "active page" is remembered. Refreshing the map is done automatically as part of a few event commands, such as Control Self Switches; you can also force it to happen manually if you want to (unlikely).
Anyway, when a map loads, each event is checked in turn to figure out which page it should be on. For each event in turn, Global Switch 23 checks that event's Self Variable (the time when it was set) and sees whether the current time is later than the set time plus 86400 seconds. If so, it's ON (and vice versa) and the event's page is decided. The next event may calculate it to be OFF again, but that doesn't matter; the event's page has already been decided and remembered. It'll do the same thing if the map is refreshed.
This kind of thing isn't publicised because it's not really something people ever need to know. It just works, that's fair enough. For the rare few who want to know how it works, there's your explanation.
That was done way before my time. I just figured out how it works.
Global Switches 21 and 22 are fairly similar. Each event also has a set of temporary Self Switches ("ts") which are the same as regular Self Switches but they only remember their setting while the event is still loaded, and they flip back to false when they are reloaded. They're used for boulders and Cut trees to reset them upon leaving and returning, as well as doors to make the player walk out of them.