Creating Timers in Gamebooks
Toki <3
23 Mar 2021, 18:11Hello! I'm very new to this all and am creating a gamebook. I know that gamebooks are far less popular than text adventures, but I've already started and don't want to start over. I need assistance with creating a timer in a gamebook. I'm still not sure whether this is possible or not.
For example, I want to set a timer that starts when you enter x page. If you don't make it to y page within the time limit, you are shown z page. (Which is basically the page that shows you that you have lost.) I was also wondering whether you can put silent music in as a timer, and maybe when it ends you are shown to page z. I'm not sure.
Can anyone help me to set this timer? Is it possible? Thank you!
mrangel
24 Mar 2021, 01:57I think Quest timer's aren't available in gamebook mode. However, you can have a javascript timer.
Something like:
JS.eval("window.timername = setTimeout(function () {sendCommand('page z')}, 25000);")
This uses the name of a command, and simulates the player clicking on a link to it. The time is specified in milliseconds, so my example would send you to page z after 25 seconds.
And then on page y, you would cancel the timer:
JS.eval("if (window.timername) { clearTimeout(window.timername); window.timername = 0;}")
Toki <3
24 Mar 2021, 02:10This works! Thank you.