Variables and javascript

So i want to generate a random value with the Math.random(method) and then toss it to a variable so i can print it (with these {varname} that squiffy offers).
also want to check that value with an if and depending the the conditions i want a different section or passage to be shown. I think it needs javascript.
(So far, what i have managed to do is to generate a random number( form 1 to 10),then round that number and check that value with some if statments. The thing that i can't seem to figure out is how/if it is possible to put a different pasage or section on each if statement.)
Example: if(condition)
{
[section.]
[[name]]:
(...)
}



[[One to Ten]]:
    var rnd = Math.ceil(Math.random() *10 );
    squiffy.set("rnd",rnd);

    squiffy.story.go("Start");


[[Start]]:
{if rnd=1:one}{if rnd=2:two}{if rnd<>1:{if rnd<>2:Well I don't know what the number is, but it ain't one or two!}}

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

Support

Forums