Squiffy timeout
It's easy to sleep or pause or delay for x milliseconds in Squiffy. The following code makes use of the javascript setTimeout function (each Section in your Squiffy source code can call javascript code if it precedes all other Squiffy script in that passage). You can copy/paste the following code into a new Squiffy project and it will run:
[code] [[Start]]: setTimeout(function () { squiffy.story.go("next"); }, 2000);
Hello Bob!
[[next]]: setTimeout(function () { squiffy.story.go("next2"); }, 2000); Bob, are you there??
[[next2]]: Hmm, Bob's not around... [/code]
Javascript has a function called setTimeout
that allows us to run a function once after the specified interval of time. For instance, this code calls sayHi()
after one second:
function sayHi() {
alert('Hello');
}
setTimeout(sayHi, 1000);