F12 is a fast reset feature. At least I believe the purpose is to make testing faster by resetting the game with one button press.
RPG Maker XP
Pressing F12 would case the next Graphics.update or Graphics.transition call to throw a Reset exception. If uncaught this would make the script start from the beginning again.
Yes, no clean-up or proper reset would occur. Instead in the current ruby session with whatever state of its variables it would start again from the top. What a recipe for disaster, but no matter.
Since it the error was only thrown by those two method calls, which luckily do not affect the actual game state we can manage to work around the issue:
https://sites.google.com/site/zeriabsjunk/scripts-/f12-pause
Yes, I have changed the behavior to F12 being a Pause button toggle. Not perfect, but at least pressing the button will not break the game anymore.
RPG Maker VX
Oh joy, what a change. Probably a wrongful reaction to the time-limit removal between each Graphics.update call (No Graphics.update call within 9~11 seconds in RMXP and it will crash with "Script is hanging"). Now the Reset exception may be thrown at any given time. Yes, including error handling code dealing with the Reset exception. My previous workaround would no longer work.
There is this funny thing, that not all scripts can handle being run twice. To be more general all scripts makes assumptions about the context within they run. Suddenly and violently breaking apart the game with an exception that be thrown at any given time, well who knows what state the Ruby interpreter when the game started interpreting the script section from the top again. Yes, the hidden scripts within the dll was not interpreted again.
The most typical failing condition was the infamous Stack level to deep exception caused by a aliasing a method whose original method was not interpreted during the reset. Luckily there is something we can do about. Yes, we can properly reset the game:
http://pastebin.com/KdBFd0Cn
With that Stack level too deep exception blowing up in-your-face error so reliable the chance of developers getting a fix is quite high. Note: These issues are also present on RMXP, and the proper F12 reset will work there as well.
RPG Maker VX ACE
Now you wonder: How can they make it worse?
By symptom treatment. The new rgss_main block is obviously designed to prevent the common Stack level too deep issue. Yes, no solution for the fundamental issue. What happens if the reset occurs during the creation of a sprite? Would it crash, only sometimes, never? What about creation of global variables. Who knows what the state of the game is. So you are now left with some of the weird errors you may have seen at some script topics. Like a graphic error, or a rare hard-to-reproduce game crash because something was only half-initialized. Those kind of errors could just as well occur on VX, but without the excellent Stack level too deep errors to make developers add a proper reset script you are left with something worse. Some potential murky error only triggered by proper F12 key press timings. While you probably can create code that can deal with this uncertainty, it is an absolutely silly increase in complexity with probably accompanying increase in bugs and decrease in performance.
Do not expect scripts to handle it. Scripters should not care about it more than point you to a script that solves the issue.
Have a RPG Maker VX ACE project? Just do it. Add a script like this to your project: http://forums.rpgmakerweb.com/index.php?/topic/8000-f12-reset-fix/
Yes, the F12 reset feature is interesting in that it has become decidedly worse from version to version. Kinda makes me wonder how Enterbrain will outdo themselves for the next version.
*hugs*
- Zeriab