Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ThallionDarkshine on November 08, 2013, 09:13:11 pm

Title: [XP] F12 Stack Level Too Deep Fix
Post by: ThallionDarkshine on November 08, 2013, 09:13:11 pm
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




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




Author's Notes

None. Use freely, no credit necessary.
Title: Re: [XP] F12 Stack Level Too Deep Fix
Post by: ForeverZer0 on November 08, 2013, 09:51:02 pm
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.
Title: Re: [XP] F12 Stack Level Too Deep Fix
Post by: LiTTleDRAgo on November 08, 2013, 10:42:35 pm
at least this one didn't spawn any game.exe
Title: Re: [XP] F12 Stack Level Too Deep Fix
Post by: ForeverZer0 on November 08, 2013, 10:50:56 pm
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.
Title: Re: [XP] F12 Stack Level Too Deep Fix
Post by: ThallionDarkshine on November 09, 2013, 09:02:14 am
Alright, updated to version 1.1. Now it used the Graphics.frame_rate.
Title: Re: [XP] F12 Stack Level Too Deep Fix
Post by: LiTTleDRAgo on November 09, 2013, 10:45:28 am
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?