Avoid chain-skipping display text actions

  • #1, by pinsThursday, 27. April 2017, 20:03 3 years ago
    Hey it's me again with YET ANOTHER QUESTION!

    This one's about display text.
    The way I've set things, a text action part does not skip automatically, you always have to click to progress. Thing is, some of my beta testers seem to confuse the game with cookie clicker and end up skipping two text parts in a row.
    So here's my question: Would it be possible to automatically "freeze" the cursor for, like 100ms right after skipping an action part? I was thinking, maybe adding a pause, or some scripting magic.

    Thanks & cheers!

    Newbie

    66 Posts


  • #2, by afrlmeThursday, 27. April 2017, 21:32 3 years ago
    Hey it's me again with YET ANOTHER QUESTION!

    This one's about display text.
    The way I've set things, a text action part does not skip automatically, you always have to click to progress. Thing is, some of my beta testers seem to confuse the game with cookie clicker and end up skipping two text parts in a row.
    So here's my question: Would it be possible to automatically "freeze" the cursor for, like 100ms right after skipping an action part? I was thinking, maybe adding a pause, or some scripting magic.

    Thanks & cheers!
    you could probably use the Lua registerEventHandler for textEnded & inside of that call a called by other action block which contains something like... hide cursor > pause 100ms > show cursor.

    Personally, my solution was to wrap texts inside of cutscene action parts to disable left clicking entirely.

    Imperator

    6846 Posts

  • #3, by pinsThursday, 27. April 2017, 23:17 3 years ago
    Well, come to think of it, I don't think I've ever used a "called by other action" in a script before, so I'm not sure how to go about doing that.
    Basically, I'd add a definition script like:

    function textStopped()
    do action("ActionName")
    end
     
    registerEventHandler("textStopped", "textStopped")

    That doesn't feel right and I know I'll look stupid.

    Newbie

    66 Posts

  • #4, by afrlmeThursday, 27. April 2017, 23:35 3 years ago
    Almost mate. Almost. smile
    function txtEnd(text)
     if text.TextOwner:getId().tableId ~= eObjects then
      startAction(Actions["click_delay"])
     end
    end

    registerEventHandler("textStopped", "txtEnd")
    1
    2
    3
    4
    5
    6
    7

    ... something along the lines of that.

    P.S: you can actually directly hotlink to an action rather than globally. i.e: Scenes["example"].SceneActions["action_name"]

    Let us know if you manage to sort it out.

    P.P.S: it's a shame there's no option to turn off text skipping with left click in general. There's only the option to disable it whenever begin/end cutscene or hide/show cursor is active.

    Imperator

    6846 Posts

  • #5, by pinsThursday, 27. April 2017, 23:44 3 years ago
    Ah, well, I wasn't far off, except in every single respect grin Thanks!

    I gave it a try, but it didn't seem to be working, as the action wasn't called at all.
    I got rid of the condition, like this:

    function txtEnd(text)
    --if text.TextOwner:getId().tableId ~= eObjects then
    startAction(Actions["click_delay"])
    --end
    end


    registerEventHandler("textStopped", "txtEnd")
    1
    2
    3
    4
    5
    6
    7
    8


    And now the action is properly called (I used a very long pause for testing purposes), but the trouble is that, hidden cursor or not, I can still skip the text by left clicking. So, maniacally clicking still does in fact maniacally chain-skip the text.

    Maybe I will have to manually add a pause when I have more than one "display text" action part, which will be some chore.

    Newbie

    66 Posts

  • #6, by afrlmeFriday, 28. April 2017, 00:56 3 years ago
    There's an option always allow to skip active text inside of the game tab which allows you to disable/enable text skipping during cutscene/hide/show cursor events, make sure this option is unchecked. You can also enable/disable the option with Lua script, like so...
    game.AlwaysAllowSkipText = false -- prevent text from being skipped with left click during cutscene or hide/show cursor event
    1

    or...
    game.AlwaysAllowSkipText = true -- allow text to be being skipped with left click during cutscene or hide/show cursor event
    1

    As far as I know, the query I added should work - unless I mixed something up. Basically it was just supposed to check that the text didn't belong to a display object text action part, seeing as it only makes sense to trigger the delay if the text belongs to a character or is a narration text.

    I suppose you could change the if query to...
    [code]if text.TextOwner:getId().tableId == nil or if text.TextOwner:getId().tableId == eCharacters then[code]

    Imperator

    6846 Posts

  • #7, by pinsFriday, 28. April 2017, 10:00 3 years ago
    Fantastic, that works like a charm! No more accidentally skipping twelve "display text" action parts because of frantic clicking.

    Here's what the script looks like:

    function txtStart(text)
    if text.TextOwner:getId().tableId == eCharacters then
    startAction(Actions["click_delay"])
    end
    end

    registerEventHandler("textStarted", "txtStart")
    1
    2
    3
    4
    5
    6
    7


    and the click_delay action is simply :

    Execute script: game.AlwaysAllowSkipText = false
    Pause 500ms
    Execute script: game.AlwaysAllowSkipText = true
    1
    2
    3


    I've switched textEnded with textStarted, it works the same except that people won't be able to accidentaly skip the first display text action: with textEnded, only the second one was protected.

    Thanks again! I'll let you know if I run into some problem after extensive testing.

    Newbie

    66 Posts

  • #8, by afrlmeFriday, 28. April 2017, 11:30 3 years ago
    Do you have the texts wrapped around inside of cutscene or hide/show cursor event wrapper?

    game.AlwaysAllowSkipText = false just prevents text from being skipped if it's inside of either of what I just mentioned above.

    It makes more sense to create the delay on text start, I guess. smile

    Imperator

    6846 Posts

  • #9, by pinsFriday, 28. April 2017, 11:35 3 years ago
    Ah, not always, actually, some texts are outside of that, and they indeed can quickly skipped (they're not affected by that fix, is what I mean).
    Would I need to make every "display text" occurence a cutscene?

    Newbie

    66 Posts

  • #10, by afrlmeFriday, 28. April 2017, 11:46 3 years ago
    For game.AlwaysAllowSkipText = false to work? Yes! This is why I said it would be nice if their was an option available to prevent text skipping in general. Maybe Simon can implement one at some point - it's not like we can't manually assign text skipping to some of other keyboard key or to a button on an interface (with a bit of work). There's an action part for skipping currently displayed text in the miscellaneous action part section.

    Quick note: if you wrap texts inside of begin/end cutscene, they can be skipped with ESC. If you wrap them in hide/show cursor then they can't be skipped, except by left clicking - if game.AlwaysAllowSkipText = true.

    Imperator

    6846 Posts

  • #11, by pinsFriday, 28. April 2017, 12:02 3 years ago
    Oh, right, yeah, I can see why that would be a good idea.

    Well, I modified the "click_delay" action like this:

    hide cursor
    Execute script: game.AlwaysAllowSkipText = false
    Pause 500ms
    Execute script: game.AlwaysAllowSkipText = true
    show cursor
    1
    2
    3
    4
    5


    So now, basically, every text displayed by a character will start by hiding the cursor. It doesn't make a real difference on the gameplay, since the cursor was already hidden when text was displayed, but at least I don't need to start a cutscene every time. I went for "hide cursor" instead of "begin cutscene" because I didn't want to interface to be invisible in those cases.
    I think it works, I will have to test it further.

    Newbie

    66 Posts

Write post