Howdy, Stranger!

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

Timed transitions to other passages?

Self explanatory subject :) But is there a way so that a passage automatically moves into another after certain amount of time?

Comments

  • here is how I do it with JavaScript settimeout and the twee API, though there may be a macro or other feature that does something similar.
    <<set $timer = setTimeout(function(){state.display("passageNameHere")},30000); /*display [passageNameHere] after 30 secconds*/ >>
    Example below is the above code refactored into a reusable function. To implement, add the following code block to a passage tagged "script".

    window.displayTimer = function(passagetitle,delay){
    delay = delay || 0;
    return setTimeout(function(){state.display(passagetitle)},delay);
    }
    Use function as follows.  The twine variable, "$timer", can be any name you want.
    <<set $timer to displayTimer("passageNameHere",30000) >>
    Cancel a timer using clearTimout().

    <<set clearTimeout( $timer );>>
  • Jesus! I've been in your blog dozen in times, and I keep discovering macros I hadn't seen before :S

    Thanks, L!  :D That's perfect.
  • Hello Hank,

    Thanks for your code. I works perfectly to put the timer and activate it. But the variable the code

    <<set clearTimeout( $timer );>>

    doesn't work when i put it into a passage with text. Can anybody help me please? This is very URGENT (for tomorrow :/ )

    Thank you very much !

    PS: I use the Timer in order to display several passages of one scene while the player is playing (in the story, the player plays while others characters are speaking)
Sign In or Register to comment.