How did these monkeys get here? How can I get things to randomly appear with exclusions

On the island in my game I want a group of monkeys to crop up here and there but to always be in some places and never in others.

I have a volcano and a chance of eruptions in certain places.

Instead of going north in the palm grove:
	if a random chance of 1 in 4 succeeds:
		say "As if to underscore the menace of the place as you turn to leave, a deafening crack splits the sky and the ground jerks first one way, and then another, accompanied by a huge plume of hot ash spewing from the top of the volcano. A moment later huge chunks of red-hot stone begin to rain down on the scoria field ahead.";

I imagine I could do the same thing with a thing but there’s probably a better way than putting it in all over the place.

A group of chattering monkeys is a backdrop.
It is in room A, room B, room C, and room D.

“Backdrops” are set pieces that can show up in multiple locations without needing to be explicitly moved.

Can you interact with them?

Sure, if you want to.

The description of the monkeys is "Monkeys!"
Instead of taking the monkeys: say "Catching monkeys is non-trivial and you do not succeed."
Instead of burning the monkeys: say "Do you really think that would improve this situation?"

I do!

That’s fun. Can it be randomly decided if they’re in a place other than the required one?

Is flavour stuff like that appreciated, expected or, annoying to a modern audience?

Lastly, is it possible (I’m not ready for this but I’m interested in the upper limits of what the language can accomplish) for the monkeys to randomly be somewhere and to have a random description selected from a library of responses?

This for me is one of the most enjoyable things to work with in I7:

§5.7. Text with random alternatives

Sometimes we would like to provide a little quirky variation in text, especially in messages which will be seen often. We can achieve this with the “[one of]… [or] … [or] …” construction.

say "[one of]"

This text substitution produces no text. It’s used only for a side-effect: it switches between a number of alternative texts, which follow it and are divided by “[or]” substitutions, according to a strategy given in closing substitution. Example:

“You flip the coin. [one of]Heads[or]Tails[purely at random]!”

Here there are just two alternatives, and the strategy is “purely at random”. Exactly half of the time the text will be printed as “You flip the coin. Heads!”; and the other half, “You flip the coin. Tails!”.

[…]

http://inform7.com/book/WI_5_7.html

Another option, if you want them randomized rather than always in those locations:

Some monkeys are an animal. They are plural-named.
Every turn when the monkeys are not in the location and a random chance of one in three succeeds:
    say "With a clamor of chattering, the monkeys arrive!";
    move the monkeys to the location.

This uses the “animal” class instead of the “backdrop” class, and just moves them randomly to the location of the player. This is better if you want them to only show up sporadically rather than being omnipresent.

1 Like

Nice!

@Draconis

So, keeping in mind I’m trying to be a well organised coder, where would such a thing go?

As a good story writer, you have to guide the player’s attention.

Ask yourself what the monkeys are “for” in story terms. If you go to an obvious amount of trouble to code them, then the player will expect them to be important to the plot. If they’re just a “hey, don’t forget you’re in a jungle!” effect, then a deliberately vague reference to “somewhere in the lush foliage, monkeys howl and jabber” might be more appropriate.For example, we often want to implement “soft” boundaries to the map, so that the player trying to travel in an unimplemented direction gets an appropriate, rather than immersion-breaking response, e.g.:

We go to quite a lot of trouble to hide the machine behind the world, with the idea that players can then more easily enter into the spirit of the game, but sometimes we want the machine to peek through just enough that the player gets a hint that they’re wasting their time pursuing their current line of play.

For example, we often want to implement “soft” boundaries to the map, so that the player trying to travel in an unimplemented direction gets an appropriate, rather than immersion-breaking response, e.g.:

Instead of going north in* the beach, say “The surf looks far too rough and dangerous.”

Instead of going northeast in the beach, try going north. Instead of going northwest in the beach, try going north.

Now whenever the player attempts to move in a northerly/seaward direction, they not only get an appropriate message, but get the same message: experienced gamers will quickly recognize the subtext and not waste any further time, whereas if we’d implemented three different messages for the three directions: say, one about the sea being too rough around the rocks, one about it being too deep to wade, and one about suspecting there are sharks about, the player might compare the three messages and think “AHA! So I have to build a raft, eh?” And then get frustrated trying to work out how to do it when all we meant was “forget the sea: the game’s all about the island.”

1 Like

That’s a good reminder.

The monkeys don’t do anything, but they are a part of the finale. In a sense they’re the heartbeat of the island, and with the volcano threatening this paradise it will slowly dawn on the players that its not just about them escaping.

At least, that’s the hope.

Glad you managed to make sense of the post – I’ve been having a bit of Firefox trouble today.

Me too. I wonder what’s up?

I’m pretty pleased with how this turned out. Thank you. My last question (about these monkeys) is how can I make sure they don’t arrive in certain locations, not just where they already are, but places they couldn’t get to or wouldn’t go?

Some monkeys are an animal. They are plural-named.
Every turn when the monkeys are not in the location and a random chance of one in two succeeds:
	say "With [one of]a clamor of chattering [or]catlike stealth [or]deafening screams [or]clicking and cackling [then at random], the monkeys arrive. They begin to [one of] groom each other [or]eye you suspiciously [or]munch on some fruit [then at random] .";
	move the monkeys to the location.


Instead of taking some monkeys: say "Catching monkeys is non-trivial and you do not succeed."
Instead of burning the some monkeys: say "Do you really think that would improve this situation?"

The taking and burning rules were examples, btw; replace them with whatever interactions you want.

But sure!

A room can be monkey-accessible. A room is usually monkey-accessible.
The Grand Ballroom is not monkey-accessible.

Then just add “…and the location is monkey-accessible” to the conditional.

Thanks for that. You’ve explained that well. I will change the set-dressing on those lines after I’ve got the framework right.

I understand the concept but I’m only half-way on the implementation. Somewhere in an upper section/page/part I put -

A room can be monkey-accessible. A room is usually monkey-accessible.
The Grand Ballroom is not monkey-accessible.
The Wreck is not monkey-accessible.
The Cave is not monkey-accessible. [or whatever...]

However, I’m don’t understand-

In my head, saying “a room is usually monkey-accessible” would mean you wouldn’t need to specify that a room was monkey accessible so I’m missing something in this.

Every turn when the monkeys are not in the location and the location is monkey-accessible and a random chance of one in [whatever] succeeds:

Of course. I feel foolish. Thank you.

I’m sure you’ve heard it before, but this is the most patient and generous community ever.

Oh

An interesting thing happened and I wanted to make sure there’s not a bigger problem afoot. When I added the following code-

The game started at The Shallows not the Beach (which is always first). When I switched the order it went back to the beach being first. I know I can specify which location is first but rather than just doing that I wanted to be sure there wasn’t a bigger problem I was just papering over.

Nothing deeper, just a weird little quirk of Inform that can trip people up. Whichever room is mentioned first in the game, no matter where or in what context, is the default starting location.

You can override this with an explicit “the player is in the Beach” or whatnot.

Okay good.

This monkey business is teaching me a lot.

Even though I have the following, I can’t keep the monkeys out of the fruit grove and I want to check the rule that if the monkeys are there already they won’t show up. I could just ban them explicitly but I’d rather I got the rule implementation correct.

Tiny monkeys are an animal. They are plural-named.
Every turn when Tiny Monkeys are not in the location and the location is monkey-accessible and a random chance of one in two succeeds:
	say "With [one of]a clamor of chattering [or]catlike stealth [or]deafening screams [or]clicking and cackling [then at random], the monkeys arrive. They begin to [one of] groom each other [or]eye you suspiciously [or]munch on some fruit [then at random] .";
	move the tiny monkeys to the location.

Part - 2 Where are they

A room can be monkey-accessible. A room is usually monkey-accessible.
The Beach is not monkey-accessible.
The Shallows is not monkey-accessible.

and in the room…

The Fruit Grove is a room.  the fruit grove is north of the headland view. "The air here is thick with the hum of bees and the smell of flowers. Tiny monkeys swing through the branches of a multitude of different fruit trees before resting on branches to chatter at you."

Tiny monkeys are in the fruit grove. The description of tiny monkeys is "Monkeys!".