How to not relist the room when entering/exiting an enterable object

I have:

The Lab is a room.

A podium is in the lab.

A bed is in the lab. The bed is a supporter. The bed is enterable.  The description of the bed is "A standard single bed.".

The black spider is on the bed.

[I'm doing the following because I need to do some custom stuff when entering the bed]
Instead of entering the bed:
	now the player is on the bed;
	say "You get snuggly in the bed.".
	
Test me with "x bed / enter bed / exit".

And the result is:

fpqAeFp

When entering and exiting the bed the entire room gets relisted and it looks quite weird to me. Is there a way of avoiding this (I don’t want Inform to print the content of the red rectangles)? I admit that I don’t know if this is easily achievable or even advisable.

Also since making another topic just for this is probably too much… if I wanted to have some custom text instead of the auto-generated “On the bed is a black spider” how do I achieve that?

move the player to the bed, without printing a room description;
2 Likes

For the text that comes from exiting the bed:

The describe room emerged into rule does nothing. 
The describe room stood up into rule does nothing. [this takes care of "get off bed" as opposed to "exit"]

I believe these are the rules that print the things you don’t want. A

And if you want to zap similar text when you don’t have a special rule for entering a supporter/container:

The describe contents entered into rule does nothing.

For the blue text, you can make the bed a scenery supporter, unlist the describe what’s on scenery supporters in room descriptions rule, and put some text about the bed in the room description:

The Lab is a room. "Description of the bed needs to go here now."

A podium is in the lab.

A bed is in the lab. The bed is a scenery supporter. The bed is enterable.  The description of the bed is "A standard single bed.".

The describe what's on scenery supporters in room descriptions rule does nothing.

The black spider is on the bed.

(If you want to zap this rule for the bed only, that would take a little more work but is doable.)

1 Like

Thanks to you both! Now the entering/exiting works like a charm.

I’ve also tried the scenery supporter thing:

The Lab is a room. "There are three tables in the room: one red, one green, one blue. On the red table there is a black spider with long legs."

A red table is in the lab. The red table is a scenery supporter. The description of the red table is "A nice red table.".
A green table is in the lab. The green table is a scenery supporter. The description of the green table is "A nice green table.".
A blue table is in the lab. The blue table is a scenery supporter. The description of the blue table is "A nice blue table.".

The describe what's on scenery supporters in room descriptions rule does nothing.

A black spider is on the red table.

Test me with "x red table / put spider on green table / l / x green table".

and

wsU171r

The problem is that the “On the supporter there is a black spider.” is still present when examining the supporter, and I would need to change the room description based on where the spider is.

What I was trying to achieve was more something like:

[The describe what's on scenery supporters *while examining a supporter* rule does nothing.]

A red table is in the lab. The red table is a scenery supporter. The description of the red table is "A nice red table.[if the black spider is on the red table] On the red table you can see a black spider with long legs.[end if]".

or:

Rule for listing the black spider on top of a supporter:
    say "On [supporter] you can see a black spider with long legs.".

But I’m guessing it’s not that easy ;_;

For the issue of the spider showing up in the examining description, the rule that does that is the “examine supporters rule.”

One way to find you find out which rules are printing things is to type “rules” into the game prompt before you do your actions. That lists all the rules that are running. So if you type “rules” and then “x spider” you get a wodge of text that includes the following:

[Rule “standard examining rule” applies.]
A nice red table.

[Rule “examine directions rule” applies.]
[Rule “examine containers rule” applies.]
[Rule “examine supporters rule” applies.]
On the red table is a black spider.

and that will tell you that it’s the “examine supporters rule” that is producing your text.

Well, you almost certainly don’t want to delist the examine supporters rule completely. What you could do here depends on your desired behavior. You could turn it off for the one case where the spider is on the supporter and write something to supplement it:

The examine supporters rule does nothing when the spider is on the noun.

Last carry out examining a supporter when the spider is on the noun: say "On [the noun] lurks a black spider...."

Warning: this particular solution will block the game from listing anything else that’s on the noun with the spider. If you want to let that happen, you need some more code to find the list of things on the noun that aren’t the spider and print that.

Or if you want to completely preempt the description of the supporter, that’s relatively straightforward:

Instead of examining a supporter when the spider is on the noun: say "GAAHHH! A spider!"

For the other issue, you want to put something in the text that adapts the prose depending where the spider is. I came up with this, which is kind of awkward:

The Lab is a room. "There are three tables in the room: one red, one green, one blue[if the spider is on a supporter in the Lab]. [spider-supporter text][end if]."

To say spider-supporter text:
	let the platform be the holder of the spider;
	say "On [the platform] is a black spider with long legs"

(The reason for the funny placement of the periods is that when you have a period just before a text substitution, Inform often likes to throw in a line break. So we work around this by making sure that the periods are after the substitution.)

I can’t help but feel like there must be a more natural way to do this, but my usual way of doing it would be with a rule for writing a paragraph about something, and that gets preempted by unlisting the describe what’s on scenery supporters rule.

BTW, if you have three tables, it might be worth making a table a kind of thing. But your actual code might be very different (I kept writing “on a table” which Inform interpreted only as applying to the red table, since it doesn’t know that the tables have anything in common.)

2 Likes

And now I’m wishing I knew this quite some time ago.

Thanks very much for all the additional knowledge. I went on and did this…

The Lab is a room. "There are two small tables hidden in a corner: one black, one obsidian.".

The describe what's on scenery supporters in room descriptions rule does nothing.

A spider-stealth-supporter is a kind of supporter.

A black table is in the lab. The black table is a scenery supporter. It is a spider-stealth-supporter. The description of the black table is "This table is so black that you would never see a spider on it.".
A obsidian table is in the lab. The obsidian table is a scenery supporter. It is a spider-stealth-supporter. The description of the obsidian table is "This table is so obsidian that you would never see a spider on it.".
A white table is in the lab. The white table is a supporter. The description of the white table is "A nice white table.".

The examine supporters rule does nothing when the noun is a spider-stealth-supporter.
Last carry out examining a spider-stealth-supporter when the spider is on the noun: say "You look really carefully..... On [the noun] lurks a black spider!".
Last carry out examining a spider-stealth-supporter when the jug of milk is on the noun: say "On [the noun] you can see a jug of fresh milk.".
Last carry out examining a spider-stealth-supporter when the apple is on the noun: say "An apple that shoudn't be here.".

A spider-allowed-object is a kind of thing.

A black spider is on the black table. The spider is a spider-allowed-object.
A jug of milk is in the lab. The jug of milk is a spider-allowed-object.
An apple is in the lab.

Before putting something on:
	if the noun is not a spider-allowed-object and the second noun is a spider-stealth-supporter:
		if the spider is on the second noun:
			say "You don't want to disturb the spider...";
		else:
			say "You don't want to put such a thing on a dark table.";
		stop the action;
	else:
		continue the action.

Before deciding that I should find a narrative solution before going Inform mad. Thanks again!

Edit:

I solved it like this:

The Lab is a room. "There is one black table here with some foodstuffs on top of it.".
				
A black table is in the lab. The black table is a scenery supporter.

A black spider is on the black table. 
A jug of milk is on the black table.
An apple is on the black table.
A bread slice is on the black table.

The describe what's on scenery supporters in room descriptions rule does nothing.
The examine supporters rule does nothing when the spider is on the noun.

Instead of examining the black table:
	say "You look closely at the black table.[line break][line break]";
	if something that is not the spider is on the table:
		say "On the [noun] there ";
		now everything on the noun is marked for listing;
		now the spider is not marked for listing;	
		list the contents of the noun, listing marked items only, as a sentence, prefacing with is/are;
		say "[line break][line break]";
	if spider is on the table:
		say "Oh noes! A spider!!!".

Test me with "x table / take bread / take apple / x table / take milk / x table / take spider / x table".
1 Like