+1 vote
by (200 points)
Hi all, sorry for posting twice in under an hour... :)

 

But when I was testing my story in Sugarcube 2 (in Google Chrome) I clicked a link to go to a passage and it gave me an error script that says the above. Why is this happening and how can I fix this?

Thanks!!

2 Answers

+1 vote
by (159k points)
Which version of SugarCube 2 are you using?

What content does the target passage contain?
eg. Does it contain (or reference) code that is processing a large array/collection? or do you have a Task Object that is doing something similar.

Does the link itself contain code that is doing something similar?
by (200 points)
OK. I took out the print macros from the strings. After that, the problem happens less frequently but it still happens. I am going to test some things, if I find a solution I will get back to you.

Thanks so much for responding so quickly!
by (200 points)
https://drive.google.com/file/d/0BxxSWqyIW2_CQndnM244cFpvb28/view?usp=sharing

There is the link to the updated version. I tried using arrays, like you said, instead of printing the things out. Turns out the issue is still there. Is it because I'm using macros in strings?

Thanks again!
by (63.1k points)

You should really try to space out and indent your code to make it more readable; you can use <<nobr>>, <<silently>>, and line-continues ('\') to manipulate your white space to where you want it.  It took me a while just to get it to a point where I can read it and start to understand what's happening/what you're going for.

There's a lot here and I'm still combing through it, but I'm pretty sure it's a code error.  I mean, sure, a lot's going on, but its really not that much.  I think a large part of the problem is just how opaque your code is, though; I can't imagine its easy for you to edit.

by (200 points)
OK, I'll space it out. If I have a <<for>> loop inside a <<for>> loop, could that be the problem? Because that is there.
by (200 points)
I experimented a little, and I don't think the <<for>> loop is the problem. I am still a little confused at what causes this problem.
+1 vote
by (68.6k points)
The "call stack" is a data stack which stores information about function/method calls.  Exceeding its maximum size usually means that some bit of recursive code has gotten away from you.

We're likely going to need to see the code in question, however, one thing to look out for is using <<goto>> or <<include>>/<<display>> to create a pseudo-loop with recursion instead of using a proper loop via <<for>>.
by (200 points)
I made sure to take out the goto macros, and I'm using all <<for>> for loops. Is it possible I'm actually making too many variables?
by (68.6k points)
No.  Excessive variables would not cause a call stack error.  A call stack error exclusively means that there is too much recursion going on.

The parser (a.k.a. the Wikifier) itself operates recursively, so it's possible that you're doing something unwise in your code which is driving it off a cliff, figuratively speaking, which is why I mentioned the most common cause of the issue.

I have not had a chance to look at your code, so I cannot say more than that at present.
by (200 points)
OK. My code is in the above discussion, there are 2 links- it is the lowermost one.
by (200 points)
I don't think I'm using any of those macros, but I'm not 100% sure. Are there any other macros that can make that problem happen?
...