"Random" function in Squiffy ?

Thierry
When I work with Quest, I often use the "random" function of the text processor, which is really simple. For example :

{random:answer 1:answer 2:answer 3}

How can I get the same thing in Squiffy ? I tried a lot of things, but nothing worked :(


Thanks for your help !

truestories
I don't think you can do this natively, but Javascript does the trick:

    var rnd = Math.ceil(Math.random() * 3);    // random number between 1 and 3
squiffy.set("rnd",rnd);

{ if rnd=1: answer 1 }
{ if rnd=2: answer 2 }

etc..

Thierry
Thank you very much !!

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums