How to create a randomizer?

Hey i'm trying to create a randomizer for my game. I dunno how to do it. It's not mentioned anywhere!
For the randomizer i'm making, it's basically a list of stuff and i'm trying to randomize it and make it spit out a certain thing.
For example, there are three categories. A, B, and C. Now i all have items in the categories, and i'm trying to make it spit out three things, one from each category. The result of the randomization will end up like this:
(An item from category A)
(An item from category B)
(An item from category C)


Hi. This works if you want a choice to go to a different direction randomly. I'm still working on how to add percentages to the choices.

[[home]]:

[[Go home.]](start)

[[start]]:
var names = ["sleep","work","play"];
var randInt = Math.floor(Math.random()*3)+0;
set("variable",names[randInt]);

[[{variable}]]

[[sleep]]:

I'm sleepy.





[[do it again]](home)

[[work]]:

boo work.





[[do it again]](home)

[[play]]:

I love playing.





[[do it again]](home)


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

Support

Forums