I am using Twine 1.4.2, running on windows 8, with the Sugarcane story format. I have the following problem:
If the user presses rapidly on a link, the link will be triggered multiple times. Any code in the linked passage will be run multiple times, once for each click. Obviously this is undesirable.
Is this a known problem? If so, what is the preferable fix?
Thank you
Comments
Help?
How do I get Sugarcane 1.2?
What do you mean? I created a macro to spam clicks and I can't get it to do what I think you're talking about on any of my twine stuff.
Can you explain exactly what the problem is and how you're getting it to happen? And also why it is a problem? I ask because I don't see why players would be spamming clicking so fast that it would cause multiple things to open, and how that would be a major problem. I understand that visiting a page multiple times could be problematic depending on the setup, but I've never gotten multiple openings by clicking quickly, and never heard of anyone having problems because they're spamming the link like spaz.
The version listed in its engine.js file is 4.2.0
Could you explain where you found the information about a different version?
http://www.nagnazul.com/whyirun/whyirun_bugged.html
On my browser (standard chrome with adblock) I can mash click a link, triggering the transition multiple times.
You can also see that every time I click a link, the time advances; if I click a link multiple times, the code gets run multiple times and time advances more than once per link, which is bad. There are more severe implications later on, which allow players to perform illegal moves.
When I mention the Sugarcane version, I am talking about this comment in the source code:
Made in Twine 1.4.2 (running on Windows 8)
Built on 09 Feb 2015 at 11:33:58, -0500
Sugarcane is based on:
TiddlyWiki 1.2.39 by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
Published under a BSD open source license
---
If I look at another twine game using Sugarcane that doesn't have this problem:
http://auntiepixelante.com/annajam/
The source code mentions:
Sugarcane 1.2 is based on:
TiddlyWiki 1.2.39 by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
Published under a BSD open source license
Copyright (c) Osmosoft Limited 2005
---
This one appears to be built using Sugarcane 1.2, while mine only says "Sugarcane", which I assume to be version 1.0.
You assume incorrectly. The version that comes with Twine 1.4.2 is the latest version of Sugarcane.
I'd surmise that your problem stems from Sugarcane's default passage transitions. I believe that the following code should relieve the symptoms you're experiencing: (goes in a
script
tagged passage)Should I expect any side effects from this fix? It doesn't seem to change anything visually, the text still fades normally.
Extended Explanation:
The problem you were experiencing was not because of CSS transitions, in general, but because of the way that the current version of Sugarcane implements its CSS-based outgoing passage transitions. As long as CSS-based passage transitions are enabled, regardless of if you're using an outgoing transition (via CSS) or not, Sugarcane keeps the outgoing passage around for approximately one second (currently a fixed duration). This creates a window during which any kind of actionable UI (e.g. link, button, etc.) not covered by the incoming passage (which is placed overtop the outgoing passage by default) may continue to be interacted with.
The older, non-CSS-based, passage transition codepath, does not keep the outgoing passage around at all. As soon as it's time to transition the incoming passage in, the outgoing passage is immediately removed. This eliminates the window whereby extra clicks were being allowed.
To recap: Neither CSS-based passage transitions, in general, nor, specifically, outgoing passage transitions should be problematic. It's simply that the current implementation in Sugarcane (and Responsive) is a little off.