Howdy, Stranger!

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

Auto-display Next Passage Based on Time

Hi all,

Is there any way to auto-display a passage after a set amount of time? For example, after 3 seconds a passage saying "Hey" would automatically move to a passage saying "Hey hey!" without any prompting or clicking.

Thanks!

Comments

  • You need to say which story format you are using as answers can be different for each, I am going to assume you are using Harlowe (documentation)

    You can use the (live:) macro to make something happen based on a timer, and the (goto:) macro to move the Reader to a different passage.
    Add the following to a passage.
    Hey!
    (live: 3s)[(goto: "Hey Hey")]
    
    (Just wait three seconds to see the next passage named Hey Hey.)
    
    Create a passage named Hey Hey and add the following:
    Hey Hey
    
  • Awesome, thanks so much! Sorry for not mentioning the format, I'll make sure to remember for next time.
  • A follow up - is there any way to cancel out of the 'live' by clicking on a passage link? For example,
    Hey!
    (live: 3s)[(goto: "Hey Hey")]
    
    [[Hey hey hey]]
    

    where clicking 'Hey hey hey' would not revert over to 'Hey Hey' after 3 seconds.

    Thanks!
  • edited June 2015
    Make travelling to "Hey hey" conditional on a variable that you initialize to true. When you click "Hey Hey Hey", set that variable to false. That way, while the live macro will try to fire, it will find the variable false, and so not trigger the link.
  • Amazing, thanks so much!
  • edited June 2015
    Basically the two ways to stop a (live:) macro doing something over and over again are to either: a) move to a different passage which results in the timer being removed from the DOM , or b) use a (stop:) macro.

    The problem with the (stop:) macro is that it needs to be inside the container associated with the (live:) macro. You can use a $variable to control if the macro does what you want or stops.
    (set: $auto to true)
    Hey!
    (link: "Hey hey hey")[(set: $auto to false)]
    
    (live: 3s)[(if: $auto)[(goto: "Hey Hey")](else:)[(stop:)]]
    

    The above (live:) macro re-formatted to made it easier to read:
    (live: 3s)[
    	(if: $auto)[
    		(goto: "Hey Hey")
    	]
    	(else:)[
    		(stop:)
    	]
    ]
    
Sign In or Register to comment.