Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Strange Slow-down with printed setter-links

First of all, hello everybody! It's good to be here.

Secondly, I've come upon a strange behavior/bug tonight, and really don't know what to make of it. I am using the Responsive story format.

The issue is as follows:

I find myself needing to use the <<print>> macro to display a particular piece of code, mainly because it is a mixture of HTML and Twine variables/expressions, and I basically need to set one of the classes for a div from a variable. This is a passage the primary purpose of which is to draw a map from an array (randomly generated at start of game). It uses recursion to simulate a for loop. This seems to work pretty well, for the most part. Each generated "tile" of the map contains a link which then takes the player to a random event/encounter based on terrain type (forest, town, ruins, etc.). It all functions the way it should, until I try to include a numerical index in the setter link of each tile (for reference once the even has already begun - mainly calculating distances between tiles). The code looks like this:


<<nobr>><<if $Draw_Counter <= 29;>>

<<set $Draw_Counter += 1;>>
<<set $NewTile = $TileSet[$Draw_Counter - 1];>>
<<set $NewIndex = $Draw_Counter - 1;>>

<<print "<div class='cell " + $NewTile + "'>[[GO HERE|" + $NewTile + "_roll][$TileIndex to " + $NewIndex + "]]</div>">>
<<DrawWorld>> /% This is where the recursion happens - it calls itself %/

<<endif>><<endnobr>>

Okay, so here's the thing. All of the above basically works...I mean, the variables all get set, all the links lead where the should, etc. I've debugged that aspect of it. But any time this piece of code is called (specifically with the setter link), the loading time for the game, and for any passage that contains the setter-link, slows to a crawl. I mean, it literally takes about eight seconds to get from a white screen to the first passage of the game, and the same amount of time to move between passages that contain the map. This only happens when I use the setter-link. When I remove  [$TileIndex to " + $NewIndex  + "], the speeds are back to normal (instantaneous). On top of that, setter links that are used on their own (outside of a <<print>> macro) don't cause any slow down at all. They work as advertised. Has anyone run into this issue before? I'm just utterly mystified.

Of course, my problem might be solved in an alternative fashion if someone knows the proper syntax for incorporating Twine variables within html tags (basically, setting the second "class" of the div with a variable). If I could do that without resorting to a <<print>> macro, that would make everything much simpler.

Comments

  • UPDATE: The problem seems to have mostly resolved itself (there still seems to be a delay, but it's now well within acceptable limits/barely noticeable). However, I don't think I did anything differently this time...it just stopped acting the way it was acting, seemingly of its own free will. Since I don't know what caused it, and can't replicate it, I'm rather disturbed by the whole thing (spent most of the night dealing with it too!), but for now I guess I'll just keep my fingers crossed and keep an eye out...

    If anyone has any idea what might have caused it, I'd love to hear it, if only for the sake of my own sanity. Thanks.
Sign In or Register to comment.