Howdy, Stranger!

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

How to make a timer? (displaying more text after x-seconds, preforming action after a time)

(newbie here) I am using Harlowe and either the special variable for time doesn't work how I expect or maybe I need to do something else.
Things I am trying to do with it:

display more text after x-seconds from clicking on a passage

force reader to another passage after x-seconds from clicking on a passage

how would I do this? This is what I thought would work but is doing nothing:
(if: time > 3s)[3 seconds passed] 
(if: time > 5s)[(go-to:"next")]

Comments

  • edited September 2016
    Hope it helps:
    (set: $sec to 0)
    (live:1s)[
     Seconds: $sec
     (set: $sec to it + 1)
     (if: $sec > 3)[3 seconds passed]
     (if: $sec > 5)[(go-to:"next")]
    ]
    
  • It worked! Thanks.
  • @korvas: A quick comment on why your logic did not work.

    As stated in the Harlowe Manual the time keyword returns how much time has passed since the (live:) macro started.

    eg. After one second it would equal 1s, after two seconds it would equal 2s, etc...

    When time became greater than three seconds (eg. 4s) your first (if:) macro became true, and it continue to be true for every value of time there after.

    eg. six seconds is greater than three seconds.

    There are two ways to improve the conditions of each of your (if:) macros.

    1. Specify the range (the start and end values) that each condition is true for:
    (if: time > 3s and it <= 5s)[3 seconds passed] 
    (else-if: time > 5s)[(go-to: "next")]
    

    2. Reverse the order of the conditions:
    (if: time > 5s)[(go-to:"next")]
    (else-if: time > 3s)[3 seconds passed] 
    

    Notice that I changed your example to use an (else-if:) macro for the second (third, forth, etc..) condition, this is because you want the different conditions to be mutually exclusive which basically means that you don't want them both to be true at the same time, where as it is possible for two (if:) macros to be true at the same time as shown by your original example.
Sign In or Register to comment.