0 votes
by (1.4k points)

Hello again!

Sweet SugarCube 2.21

Here is the problem:

Config.saves.autosave = "thunderbirds";
Config.saves.autoload = true;

When it is in, and the game is titled "四", the error appears; when it is not in, or the title is something else, the game works fine.

I found that it worked fine if I duplicated the game, but once I changed the name from "四 Copy" to just "四" it broke. Just to see if it was renaming the game that broke it I changed the name back to "四 Copy", and it worked, changed it back to "四", and it broke. To see if having only a number for a name was messing it up I changed it from "四" to "4", and it worked. (Oh no! Racism!)

The error that comes up when it breaks is difficult to describe. When I try to include a certain passage the error comes up: "Error: cannot execute macro <<include>>: Maximum call stack size exceeded". But only if one of the first two cases in a <<switch random>> are picked in the passage I am trying to include. When case 3 or default are picked, it works fine. Here is the passage (called monsters1):

<<switch random(3)>><<case 1>><<if $blistergrim is 1>><<include "monsters1">>
<<else>><<include "blistergrim">><<set $kill to "a blistergrim">><</if>>

<<case 2>><<if $glubose is 1>><<include "monsters1">>
<<else>><<include "glubose">><<set $kill to "glubose">><</if>>

<<case 3>><<if $bandersnatch is 1>><<include "monsters1">>
<<else>><<include "bandersnatch">><<set $kill to "a bandersnatch">><</if>>

<<default>><<if $muskdrake is 1>><<include "monsters1">>
<<else>><<include "muskdrake">><<set $kill to "a musk drake">><</if>><</switch>>

Perhaps Config.saves particularly dislikes blistergrims?

Incidentally, neither the passage or the passage it is included in or any previous passage have the tag "thunderbirds".

Thank you for your assistance!

1 Answer

0 votes
by (159k points)

> Here is the passage (called monsters1)

The problem is that you have a passage trying to include a copy of itself under specific conditions, and that it's doing it in a recursive way. This will eventually result in the "Maximum call stack size exceeded" you are seeing.

eg. The monsters1 passage includes a copy of the monsters1 passage, which includes a copy of the monsters1 passage, which in turn includes a copy of monsters1 passage, which.... etc..

> and the game is titled...

The game's Title is used in a number of places within the story's engine, one of them is the Save system. It is likely there is an assumption that the game's title will consist of standard Latin based charactes and not extended Glyph based ones.

by (1.4k points)

The only way I can think of that it could get in this loop is if $blistergrim, $glubose, $muskdrake, and $bandersnatch were all 1, and if that were so then case 3 and default would not work either. And how would Config.saves getting confused with a non-latin story name end up setting variables if a certain case was picked by <<switch random>>? 

I set the game start later in the game to test a spot which included a passage with a larger <<switch random>> that included the same cases in it, and it worked perfectly.

<<switch random(7)>><<case 1>><<if $blistergrim is 1>><<include "monsters2">>
<<else>><<include "blistergrim">><<set $kill to "a blistergrim">><</if>>

<<case 2>><<if $glubose is 1>><<include "monsters2">>
<<else>><<include "glubose">><<set $kill to "glubose">><</if>>

<<case 3>><<if $bandersnatch is 1>><<include "monsters2">>
<<else>><<include "bandersnatch">><<set $kill to "a bandersnatch">><</if>>

<<case 4>><<if $muskdrake is 1>><<include "monsters2">>
<<else>><<include "muskdrake">><<set $kill to "a musk drake">><</if>>

<<case 5>><<if $jackflit is 1>><<include "monsters2">>
<<else>><<include "jackflit">><<set $kill to "a jackflit">><</if>>

<<case 6>><<if $fellfowl is 1>><<include "monsters2">>
<<else>><<include "fellfowl">><<set $kill to "a fellfowl">><</if>>

<<case 7>><<if $larvalhydra is 1>><<include "monsters2">>
<<else>><<include "larvalhydra">><<set $kill to "a larval hydra">><</if>>

<<default>><<if $glowerine is 1>><<include "monsters2">>
<<else>><<include "glowerine">><<set $kill to "a glowerine">><</if>><</switch>>

Another odd thing is that when I set the story start to a different passage it would still go to the beginning unless I put a <<goto>> in the StoryInit passage to force it to the start I specified.

It is supposed to be a spooky game, I guess it decided to go Frankenstein's monster. I'll probably just have to humor it and change the name.

by (68.6k points)
edited by

> Maximum call stack size exceeded

As noted by Greyelf, it's an out-of-control recursion issue.  As to how you're falling into that situation?  Without seeing the project it's impossible for us to know with certainty, however, it's likely that your assumptions about your game's state at the time this is happening are incorrect for some reason.

 

> Game title

As noted by Greyelf, the story title must consist of basic Latin alphabet characters.  This is due to various, mostly legacy, reasons.

Assuming you're using the UI bar and simply want 四 to be the title displayed there, then you may do do via the StorySubtitle special passage.  Set the actual story title to something suitably basic Latin-based, place 四 within the StorySubtitle passage, and then add the following styles to your stylesheet:

#story-title {
	display: none;
}
#story-subtitle {
	margin: 0;
	font-size: 162.5%;
	font-weight: 700;
}

 

> Another odd thing is that when I set the story start to a different passage it would still go to the beginning unless I put a <<goto>> in the StoryInit passage to force it to the start I specified.

You should never use <<goto>> within the StoryInit special passage.

Very likely, one of two things is going on here:

  1. You're testing this in Twine 2 and are not closing the existing test window before attempting a new test/play.  Twine 2 does not refresh an existing test window instance, so you must close the existing instance before beginning a new test/play.
  2. During your changing of the Config.saves.[…] settings, you've managed to create an autosave.  If an autosave exists and Config.saves.autoload is set to true, the autosave will automatically be loaded without prompting.  Thus, you'll be sent to whatever the saved passage was, regardless of what the starting passage is currently set to.

It's possible that something else is going on, but those are the likely candidates.

by (1.4k points)

You can download it from here:

Si

(The file is called The Workings.)

As it is it works, but you can change the name to "四" to check out the error for yourself if you like. Or the error might vanish as mysteriously as it came (the game worked fine a few months ago, with both Config.saves as it is, and the non-latin title).

...