System Stack Error

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
Hi guys, I have a scripting problem I can't resolve.

I'm using Theo's sideview battle system, and have implemented a combo system where the player can chain together various attacks.

However, reaching a combo of 16 hits will crash the game with a 'system stack error - stack level too deep'.

I used Hime's stack debugger and it directed me to line 1839 of Theo's 'Implementation' script, that deals with fiber?

Here is a link to a fresh project that replicates the error.  https://www.dropbox.com/s/qyxesuuvahvdilx/HimeStack.exe?dl=0

To trigger the error, use the Crimson thorn skill at full TP and reach a combo of 16.

The prompts are xbox pad by default, they correspond to keyboard like this: A(prompt) = D Y(prompt) = A

The script for the move is in 'sequences'.

I left a message on Theo's blog but I noticed he hadn't replied to bug reports for a while.  If anyone knows him, please let him know of this thread.

Please help me if you can, it would be greatly appreciated.
 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
570
Reaction score
156
First Language
Serbian
Primarily Uses
N/A
Sorry, but I could not reproduce the error, with a quite a stupid issue.

When I use Crimson Thorns, letter A shows up.

I tried spamming both A and :A buttons, but none of them worked.

Could you please explain it how to use this system?

I'm not really into reading the whole script documentation right now...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,482
Reaction score
12,025
First Language
English
Primarily Uses
RMMV
That error message usually indicates you've got two scripts that are both aliasing the same class/method using the same name.


Commonly it's because a script has been put into your project twice. Look through all script slots, including those without names, and make sure you only have ONE script in each slot (that it hasn't been pasted twice into the same slot), and that no two slots have the same script.
 

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
Sorry, but I could not reproduce the error, with a quite a stupid issue.

When I use Crimson Thorns, letter A shows up.

I tried spamming both A and :A buttons, but none of them worked.

Could you please explain it how to use this system?

I'm not really into reading the whole script documentation right now...
Hi, Kocka, the prompts are xbox pad by default.

They correspond to D and A on the keyboard.  A(prompt) = D  Y(prompt) = A

Thank you for helping!

That error message usually indicates you've got two scripts that are both aliasing the same class/method using the same name.

Commonly it's because a script has been put into your project twice. Look through all script slots, including those without names, and make sure you only have ONE script in each slot (that it hasn't been pasted twice into the same slot), and that no two slots have the same script.
Yes, I researched and that seems the most common source of the error.  However I'm pretty sure I dont have duplicates.  I passed the test project to Hime and multiple copies didnt seem to be the issue.  I mean, I'm wondering if the method is defined by two different scripts?  But wouldn't that crash it right away?  Thanks for the suggestions!
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,662
Reaction score
2,984
First Language
Tagalog
Primarily Uses
It can also be an infinite loop...
 

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
It can also be an infinite loop...
Ah that's interesting Engr, since I coded two sequences that chain together as long as the user has TP for it.

It's not infinite though for that very reason, and I find it strange why a chain of 16 is the limit.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,662
Reaction score
2,984
First Language
Tagalog
Primarily Uses
Not really sure up to what is considered "infinite" by RGSS3... I was just thinking it might be one of the possible reasons as I've experienced it in the past. Normally the programs just hang up if there's an infinite loop but sometime in the past I got that error and realized it was an infinite loop of some kind.
 
Last edited by a moderator:

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
Yes, you see that's why I actually split the attack into two sequences that chain between each other, rather than just one sequence that chains into itself repeatedly, I was worried about the loop thing.

I discovered that stripping away all the code apart from the timed hits and damage lines allows the chain to get up to 25 before crashing.  So it's weird.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,662
Reaction score
2,984
First Language
Tagalog
Primarily Uses
Well, if it's calling each other then it might really be going into a stack...

So like

Code:
$stack = 0def a  benddef b  $stack += 1  if $stack < 15    a  endend#So it basically calls a which calls b inside of a which runs a again which then calls b again inside so it forms a deep stack#a# b#  a#   b#    a# and so on#the very first a call is still waiting for response in this case#so it will need to finish the deepest stack before the upper stacks can get their responses and finish execution
It might be good to see if you can make it iterate without producing a stack. I haven't looked at the file itself so...
 
Last edited by a moderator:

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
I'm not a coder but I understand what you're saying about a not being resolved before b is called.

Could you take a look at the file please?  I would greatly appreciate it! <3
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,662
Reaction score
2,984
First Language
Tagalog
Primarily Uses
I'll try... this error is one of those things that don't give an obvious source. :)
 

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
Thank you.  Let me know if you need any clarification about Theo's battle system.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,662
Reaction score
2,984
First Language
Tagalog
Primarily Uses
Did you only test it during battle test and not really in-game?


PS: Sadly, there are far too many scripts in there that I don't have experience in... It doesn't even seem to have Hime's debugger which you used to pinpoint the error into the line.
 
Last edited by a moderator:

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
570
Reaction score
156
First Language
Serbian
Primarily Uses
N/A
I don't think sequences are the problem, since those sequences can end anytime, with just you not pressing any button.

I think the problem is that Theo's script does something in background that makes his system limited to only 16 combos.

Can you please post here the direct link to Hime's debugger, since I remember I could not access it last time (I think it was Dropbox error or something...)
 

HuntingSwan

Veteran
Veteran
Joined
Jun 16, 2014
Messages
68
Reaction score
40
First Language
English
Primarily Uses
Did you only test it during battle test and not really in-game?

PS: Sadly, there are far too many scripts in there that I don't have experience in... It doesn't even seem to have Hime's debugger which you used to pinpoint the error into the line.
I tested it in game too, this was for my IGMC 2015 game Kazimir.  

I don't think sequences are the problem, since those sequences can end anytime, with just you not pressing any button.

I think the problem is that Theo's script does something in background that makes his system limited to only 16 combos.

Can you please post here the direct link to Hime's debugger, since I remember I could not access it last time (I think it was Dropbox error or something...)
Sure: http://himeworks.com/redirect.php?type=script&name=System_Stack_Debugger

Unfortunately it only gives you one line of info though, about line 1839 of the Implementation script.
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
570
Reaction score
156
First Language
Serbian
Primarily Uses
N/A
Hmmmm.... the problem is very strange....

However, Theo is constantly making new Fibers when battler hits the enemy, and then puts them into $game_temp.actors_fiber[actor_id], and every Fiber has

tsbs_main_fiber functions in it.

I'm not really sure how this can cause SystemStackError...
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,773
First Language
German
Primarily Uses
RMMV
yes it can - you shouldn't forget what a system stack really is.


All stacks are limited, it's only that this limit is usually so high, that only unintended iterations can break it - like what is happening with two identical scripts.


But if the program has functions that intentionally call themselves, and is using stack for keeping track, then it will cause the stack to overflow.


And that is what the original message basically says - it prevents a stack overflow by canceling further access (otherwise a stack overflow could be used for injection-type attacks).


However, I don't know enough of ruby or that script to find the cause - and if it's an intentional iteration, then the bugfix won't be a few lines only...
 

KockaAdmiralac

Cube-shaped garbage can
Veteran
Joined
Jun 15, 2015
Messages
570
Reaction score
156
First Language
Serbian
Primarily Uses
N/A
I know of that, but nothing here is running in background and infinitely.

Theo used something like :

def insert_fiber(fiber)  if actor?    $game_temp.actors_fiber[id] = fiber  else    ...  endendand called it with parameter Fiber.new { tsbs_main_fiber }

Are other Fibers destroyed, and not running in background anymore, or using fiber = on the currently running fiber can cause that Fiber is still running in background?

Note that tsbs_main_fiber is an infinite function, that means it has something like :

Code:
def tsbs_main_fiber  # some stuff  loop do    # some stuff  endend
 

Fomar0153

All wrapped up for winter.
Restaff
Joined
Mar 13, 2012
Messages
1,239
Reaction score
231
First Language
English
Not a fix but a cap to the combos at 16 so it will prevent any crashes:

Code:
class Game_Battler < Game_BattlerBase  # --------------------------------------------------------------------------  # New method : Setup timed hit system (BETA) [:timed_hit,]  # Will expand it later. I hope ~  # --------------------------------------------------------------------------  alias fix_setup_timed_hit setup_timed_hit  def setup_timed_hit    return if SceneManager.scene.damage.hits >= 16    fix_setup_timed_hit  endend class DamageResults  # --------------------------------------------------------------------------  # * Hits  # --------------------------------------------------------------------------  def hits    @hit_count  endend
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I'm sorry about earlier. I have the most hate and the most love for my art at the same time. Felt bad about my thread because I wasn't listening, and because I made it out of a bad mindset to begin with. S'another Thursday for me.

The main character of the book)
Things you can say about your rpg maker project but not your bf/gf: I'm not super committed but it's fun to play around with it.
putting a puzzle in my game that BSODs the player's computer if they complete it

Forum statistics

Threads
94,368
Messages
920,332
Members
124,132
Latest member
voltrone
Top