Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits) (+1)

OK, so I have some hypotheses about what’s going on: a. The for loop increments x but text_node.visible_characters is unrelated. Somewhat, this value may increase more than expected at some point b. The for loop itself is correct, but text_node changes in the middle of the loop, due to parallel handling of other events. For instance:

# PRESS A BUTTON TO CONTINUE DIALOGUE
func _input(event):
	if event.is_action_pressed("continue_dialogue") and ! event.is_echo():
		if current_json_path != "":
			next()

may be run in parallel as the user presses Space just when the text reaches its last character, causing dialogue to advance to next text node. As a result, the text_node has now a different number of characters (but in practice, when getting the error text_node.visible_characters was always exactly text_node.clean_text.length()+1 (so 1 over the limit), so it doesn’t look like text is unrelated.

considering the length of the text seems to have changed between the for statement (which should check v < text_node.clean_text.length():

c. clean_text itself is changing during the loop… but I don’t see where.