Random game commentary

Every turn when the player is carrying the monkey: say "[one of]The monkey wraps his arms around your neck. [or]The monkey makes a screeching sound. [or]The monkey picks at your hair. [or][or][or][or][or][or][or][or][or][or] [at random]"

The extra [or]s are so that the game actually says something every few turns, rather than every turn. This causes some blank lines, which isn’t the worst bug in the world. But is there a better way?

This didn’t work:

Every five turns when the player is carrying the monkey:

Ditto with “Every few turns” “Random turns when” and so forth.

Should I generate a random number and then say “Every turn when the player is carrying the monkey and randomNumber is 5”? I don’t know how to get a random number generated every turn, and it seems like overkill.

Thanks

You can use “when a random chance of 1 in 5 succeeds”. See chapter 8.17.

Every turn when the player is carrying the monkey and a random chance of 1 in 5 succeeds: say "[one of]The monkey wraps his arms around your neck.[or]The monkey makes a screeching sound.[or]The monkey picks at your hair.[at random]".

Awesome, thanks.

I don’t know what it is about the book, but I never find what I need with a search. And when I read through it, I keep seeing things I already know or things I’ll never do (like changing the font size). In fact most of my successes with new ideas come from just typing things different ways until the compiler likes it.

Eventually I’ll stop being such a newbie. :slight_smile:

On a related note, this:

The description of the monkey is "[if examining for the first time]The monkey is brown with a light-colored belly, black feet and hands, and a long tail. He is very cute. [otherwise] [one of] The monkey is quietly picking through his fur. [or] The monkey stomps his feet and jumps up and down. [or] The monkey shows you his teeth. [or] The monkey seems to smile and clap his hands. [or] The monkey looks bored. [or] The monkey makes a screeching sound. [at random]".
Didn’t do what I expected – I got one of the middle messages on first examination. I tried “examining the monkey” and some other things but that didn’t work out either.

I could set a boolean and then break this into two parts, but is there a way to make this work with some other syntax?

thanks

Either

[code]Instead of examining the monkey for the first time, say “The monkey is brown with a light-colored belly, black feet and hands, and a long tail. He is very cute.”

The description of the monkey is “[one of]The monkey is quietly picking through his fur.[or]The monkey stomps his feet and jumps up and down.[or]The monkey shows you his teeth.[or]The monkey seems to smile and clap his hands.[or]The monkey looks bored.[or]The monkey makes a screeching sound.[at random]”.[/code]

or

[code]The description of the monkey is “[one of]The monkey is brown with a light-colored belly, black feet and hands, and a long tail. He is very cute.[or][randomized monkey description][stopping]”.

To say randomized monkey description:
say “[one of]The monkey is quietly picking through his fur.[or]The monkey stomps his feet and jumps up and down.[or]The monkey shows you his teeth.[or]The monkey seems to smile and clap his hands.[or]The monkey looks bored.[or]The monkey makes a screeching sound.[at random]”.[/code]

Awesome, thanks Michael.