Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Takua on October 04, 2009, 12:28:45 pm

Title: Getting a "stack level too deep" error w/ Tons
Post by: Takua on October 04, 2009, 12:28:45 pm
Whenever I press F12, I get this error:

Script 'Tons 2' line  1248: SystemStackError occured.

stack level too deep


I'm pretty sure that Zeriab made a fix for this before, but all the links I found linking to it were broken. I just want F12 to do what it normally does, to return me to the title screen at any time whenever I press it.

(Also, at the moment I'm using Dubealex's AMS, then below it are the three Tons scripts, and then below that are the three Blizz-ABS scripts.)
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: G_G on October 04, 2009, 12:39:37 pm
EDIT: Woops wrong one hang on sorry

EDIT 2: Found this I think this'll fix that
#=begin
unless $f12_cleaner_F3XXEFA1.nil?
  # Opens the game executable in a new thread
  Thread.new{system ("Game")}  # "Game" = Name of the game executable
  # Exits this thread
  exit
end

# Modifying this global variable might cause this snippet to stop working properly.
# Some garbage have been added to lessen the chance of it already being used
$f12_cleaner_F3XXEFA1 = true
#=end
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: Ryex on October 04, 2009, 01:03:36 pm

#==============================================================================
# F12 fix
#==============================================================================

if $game_exists
  Thread.new {system('Game')}
  exit
end

$game_exists = true


I think that will work a little better that the one game guy posted
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: Takua on October 04, 2009, 01:30:12 pm
Yeah, Ryex, yours worked a little better, just one thing: Now, when I hit F12, it closes the window and then opens up a new one (with the title screen up) (however, the window doesn't pop straight up, it appears in the taskbar first). I think it's supposed to do that, but is there any work-around to this? It's kind of annoying having to go and click on the new window down in my taskbar.

Also, it doesn't work very well in fullscreen mode, either (as it exits and then opens up the new, normal-sized window).

So, what I'm saying is: Is this possible to do without closing any windows in the process?
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: fugibo on October 04, 2009, 01:41:04 pm
Quote from: Takua on October 04, 2009, 01:30:12 pm
Yeah, Ryex, yours worked a little better, just one thing: Now, when I hit F12, it closes the window and then opens up a new one (with the title screen up) (however, the window doesn't pop straight up, it appears in the taskbar first). I think it's supposed to do that, but is there any work-around to this? It's kind of annoying having to go and click on the new window down in my taskbar.

Also, it doesn't work very well in fullscreen mode, either (as it exits and then opens up the new, normal-sized window).

So, what I'm saying is: Is this possible to do without closing any windows in the process?


Yep. First, put these lines around each piece of Tons:

unless $TONS_IS_ALREADY_LOADED

and

end


And then, immediately after the rest of tons, add this:

$TONS_IS_ALREADY_LOADED = true
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: Ryex on October 04, 2009, 01:55:41 pm
ya use long fellow's method instead of mine if you don't like the new window thing
Title: Re: Getting a "stack level too deep" error w/ Tons
Post by: Takua on October 04, 2009, 07:34:09 pm
Thanks Longfellow, you gave me exactly what I needed. :)