0 votes
by (390 points)
reshown by
Hello all!

I have a passage in my game, where the player has to decide within a few seconds. The problem is: Forcing a player to make a decision without "pressure" isn't fun. Now my question is: Is it possible to show a counter and jump to the next passage automatically?

Example:

The player has 20 seconds to decide if he wants to go the left or the right way. After this 20 seconds the player automatically goes the left way. The counter should be visible all the time, so the player knows he has to decide fast.

Can anyone help me? Is that possible?

1 Answer

+1 vote
by (61.5k points)
selected by
 
Best answer

Sorry, I accidentally hid this for a split second along with the glut of spam. 


Sounds like you want the <<timed>> macro or the <<repeat>> macro. Here's an example using the latter: 

<<set _time to 20>>\
You have @@#countdown;_time@@ seconds to figure out where to go! 

[[Right]]
[[Left]]\
<<silently>>
  <<repeat 1s>>
    <<set _time-->>
    <<if _time gt 0>>
      <<replace '#countdown'>>\
        _time\
      <</replace>>
    <<else>>
      <<goto 'Left'>>
      <<stop>>
    <</if>>
  <</repeat>>
<</silently>>

Warning, this code was written from memory, so I may have made a mistake. It should be enough to get you started, though. 

by (390 points)
Heyho!

First of all: Thank you very much! <3

The counter works, unfortunately the jump to the next passage doesn't. The counter sticks to 1 seconds and nothing happens. I already tried a few thing but i can't make it work.
by (61.5k points)
Sorry, I did the <<goto>> and <<stop>> backward, I think. Try switching them so that the <<stop>> is second.
by (390 points)
edited by
I need either a "i love" or at least a "i like" or "i really appreciate" button here! Now it works like a charme. Thank you really much. I should really mention you in the credits later on. :D

For everyone who is looking for the same function, here is the edited code:

<<set _time to 20>>\
You have @@#countdown;_time@@ seconds to figure out where to go!

[[Right]]
[[Left]]\
<<silently>>
  <<repeat 1s>>
    <<set _time-->>
    <<if _time gt 0>>
      <<replace '#countdown'>>\
        _time\
      <</replace>>
    <<else>>
    <<stop>>
      <<goto "Left">>
      <</if>>
  <</repeat>>
<</silently>>
by (61.5k points)

Happy to help. 

I need either a "i love" or at least a "i like" or "i really appreciate" button here!

You can't do those things, but you can select this answer, which will let future users with similar questions know that this came to a satisfying conclusion. 

I should really mention you in the credits later on. :D

I appreciate the sentiment but that's not necessary. 

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...