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

I haven’t tested this, but what it looks like to me is that this

Tiny monkeys swing through the branches of a multitude of different fruit trees before resting on branches to chatter at you.

is baked into the room description, so it will print regardless of whether the monkeys are actually in the location. So if you enter the Fruit Grove, and the monkeys are not actually there (probably because the monkeys randomly got moved somewhere else on a previous turn), you see this description, making you think the monkeys are there, but then the monkeys can still randomly arrive anyway, and then you see this

"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] .

as well.

So, possibly you could automatically move the tiny monkeys to the Fruit Grove every time the player enters it? Or else you could have two sets of monkeys–one that always stays in the Fruit Grove, and one that randomly moves around, and make the Fruit Grove inaccessible to the random set.

Edited to add: I’m assuming, since the monkeys are in the Fruit Grove description, that you always want them to be there when the player enters the Fruit Grove. If that’s not the case, you could just leave the monkeys out of the room description.

So, are you saying that including the object in the room description functions to put it in there if the object exists?

No. I’m saying that because the monkeys are mentioned in the room description, it could appear to the player that the monkey object is present, even when the monkey object is actually not present.

You could fix this either by

  • actually making the monkey object present, so the room description will be correct, and the monkeys will not randomly show up (again) in the same turn.

or

  • not mentioning the monkeys in the room description, so that when the monkeys show up randomly, the arrival message will make sense.

Oh, I see.

I’ll think on that. I kind of want the monkeys to be there in the description so I’ll have to exclude them.

Thanks for clarifying that.

Now I appear to be accumulating tiny monkeys.

How can I get them to leave after the player leaves?

I want to do an if/then check as in, If the tiny monkeys are in the current location then when the player leaves, the tiny monkeys move to off-stage.

I’ve tried various permutations but to no avail.

After leaving a location:
	move the tiny monkeys off-stage.

Is one such attempt.

Here’s another one if you’d like a laugh:

when the player leaves a location in the presence of tiny monkeys:
	move the tiny monkeys to off-stage

One thing to play with as you’re testing in the IDE:

Type the command ACTIONS…

As you continue to play, Inform will note what action it is actually trying during each command. Those are the actual action-names you need to put into rules. Watch what happens when you leave a location.

Also check out the Index tab. It’s loaded with detail about built-in actions, and it will populate new ones that you create.

IIRC, the action is “going”.

After going:
     move the tiny monkeys off-stage.

So simple. that Actions command will come in handy.

That code, as is, seems to break the game. Is it because there are no monkeys in the first room so when the player “goes” but there aren’t monkeys to move, it crashes?

I tried a few fixes along the lines of what you’ve shown me before but I’ve had no success.

After going when the tiny monkeys are present:
	 move the tiny monkeys to off-stage

I believe the “move the X to” syntax is long deprecated due to being ambiguous. You can accomplish everything it did with “now”:

After going:
	now the tiny monkeys are off-stage;
	continue the action.

Equivalently, you can also use “now the tiny monkeys are nowhere”.

By the way, that “continue the action” is important because “After” rules by default end the action in success. That stops the action machinery before the “Report” phase, so the Going action never actually goes on to describe the result of the action, including printing the new room description, unless you tell Inform to actually continue on to the rest of the action.

FWIW “move X to Y” is not deprecated. (The reason it survives and hasn’t been replaced entirely by “now X is in Y” is because sometimes we want to say “move the player to [room], without printing a room description” and that can’t be done with “now.”)

The problem with “move the tiny monkeys to off-stage” is probably that in “move X to Y,” X must be a thing and Y must be an object (specifically a room, container, supporter, or person, according to the Index). “Off-stage” isn’t an object but an adjective.

One thing you might be thinking of is that “remove X from play” has been deprecated in favor of “now X is nowhere”–that was a bit of a shock to me when it happened!

1 Like

Indeed! Though my solution was just to define “remove X from play” as “now X is nowhere” and keep using the old syntax same as ever. Old habits die hard…

3 Likes