[XP] F12 Stack Level Too Deep Fix

Started by ThallionDarkshine, November 08, 2013, 09:13:11 pm

Previous topic - Next topic

ThallionDarkshine

November 08, 2013, 09:13:11 pm Last Edit: November 09, 2013, 11:33:29 am by ThallionDarkshine
F12 Stack Level Too Deep Fix
Authors: ThallionDarkshine, CoderPuppy
Version: 1.1
Type: Error Fix
Key Term: Misc Add-on



Introduction

Have you ever been really annoyed when you press F12 to restart your game, and all of a sudden, a Stack Level Too Deep error appears? Well, this will fix that.


Features


  • Fix those annoying stack level too deep errors when using the F12 restart.




Screenshots

Not necessary. I can't think of how to show the absence of an error.


Demo

Not at the moment, pretty self-explanatory.


Script

Place at the top of the script list before anything else.
Spoiler: ShowHide
Code: ruby

if Graphics.frame_count > 0
 begin
   # Prepare for transition
   Graphics.freeze
   # Make scene object (title screen)
   $scene = Scene_Title.new
   # Call main method as long as $scene is effective
   while $scene != nil
     $scene.main
   end
   # Fade out
   Graphics.transition(20)
 rescue Errno::ENOENT
   # Supplement Errno::ENOENT exception
   # If unable to open file, display message and end
   filename = $!.message.sub("No such file or directory - ", "")
   print("Unable to find file #{filename}.")
 end
 exit
end



Instructions

None needed. The script is pretty self-explanatory.


Compatibility

No known issues.


Credits and Thanks


  • ThallionDarkshine

  • CoderPuppy (my brother) for the idea (which is basically all the script is)




Author's Notes

None. Use freely, no credit necessary.

ForeverZer0

Much simpler is the thing most people do, which I think Blizz came up with...
if $game_exists
  Thread.new {system('Game')}
  exit
end
$game_exists = true


Doesn't matter what scripts have been changed, removed, or added.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

LiTTleDRAgo

at least this one didn't spawn any game.exe

ForeverZer0

True.
A suggestion would be to use something other than checking if Game_Temp has been defined or not. Although the vast majority of projects will of course include this class, there are other things to check that won't require the dependency. One idea off the top of my head is to check if the Graphic.frame_count is greater than 0 or something. All projects, no matter what they are will have to update the Graphics, so it would remove other script dependency.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ThallionDarkshine

Alright, updated to version 1.1. Now it used the Graphics.frame_rate.

LiTTleDRAgo

Quote from: ThallionDarkshine on November 08, 2013, 09:13:11 pm
Compatibility

Will not work if the Game_Temp script is removed.


you're not editing that part?