Howdy, Stranger!

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

Bug: Player can mash-click on a link, triggering it multiple times

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

  • This is an extremely major problem for me; the game I'm working on is largely completed, but I can't release it as long as this bug is around.

    Help?
  • From what I can tell, this does not occur with Sugarcane 1.2; however I cannot find a way to download Sugarcane 1.2 and have it work with my story. I installed twine using twine_1.4.2_win (1).exe, but this apparently installs an older version of Sugarcane.

    How do I get Sugarcane 1.2?
  • Nagnazul wrote:

    This is an extremely major problem for me; the game I'm working on is largely completed, but I can't release it as long as this bug is around.

    Help?

    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.
  • As far as I know the Sugarcane story format is distributed with the Twine 1.x installer, and the latest version comes with Twine 1.4.2.

    The version listed in its engine.js file is 4.2.0

    Could you explain where you found the information about a different version?
  • Here's an (abridged) version of my game:

    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.
  • Nagnazul wrote:

    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)

    (function () {
    /* Disable CSS-based passage transitions. */
    hasTransition = false;

    /* Remove default transition styles. */
    var tcss = document.head.querySelector("#transitionCSS");
    if (tcss && tcss.parentNode) {
    tcss.parentNode.removeChild(tcss);
    }
    }());
  • Yep, that worked, thank you very much!

    Should I expect any side effects from this fix? It doesn't seem to change anything visually, the text still fades normally.
  • The code only disables CSS-based passage transitions.  So, no, I wouldn't expect any side-effects.  As far as the passage transition you're currently experiencing goes, it uses an older fading mechanism which is not CSS-based.

    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.
Sign In or Register to comment.