Howdy, Stranger!

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

Story-wide timer?

Title pretty much says it all. I'm going for a story that has a timer running the whole length of the story, a countdown if you will. Is there a certain macro that does this?

Comments

  • Put something like

    Turns: <<print turns()>>

    in the StoryMenu passage, or wherever you want it to appear. turns() is a built-in function in Twine 1.4.1 or higher that keeps track of the number of times a link to another passage has been followed by the player. Attached is an example.
  • Is that what Neoroman wants? For a start, won't it be a count up? And also, I think (he?) might want an actual timer, as in minutes and seconds. Can't be sure, though.
  • @Neoroman
    If you are using the SugarCube story format then in has two special passages named PassageReady and PassageDone.

    You could use either one of these to achieve what you want.
  • Sorry if it wasn't clear before. I'm wondering if there is a way to have a minute and seconds timer that runs throughout the story at a certain point. So when I reach a certain passage, the timer will begin at a given time, will run continuously through the rest of the story, can be stopped when X choice is made, and can be visible on any and all passages when active.

    Hopefully, this cleared things up a bit (don't want to sound too picky here :P)
  • If you mean actual elapsed time from the users point of view.

    You could use some java-script to determine the current time on the users machine using "new Date().getTime();", storing the value within a variable, then later when you want to determine how much actual time has passed you would again get the current time and compare the two values which will tell you how many milliseconds has passed between the two timestamps.

    I can't give you a source code example at the moment because I'm currently not on a machine with Twine installed.
    Besides there are many others on the forum who's Twine macro-fu is better than my own.
  • Do you want it to count down or up? And if it's down, do you want something to happen when it reaches 0?
  • I want it to count down, starting at 30 minutes. I'll change this to fit the final length of the game, but as soon as it hits 0, I want it to go to X passage.
Sign In or Register to comment.