Hiding an object under something

Hi folks! Newbie here, trying to write an Easter game for the kids. Currently stuck on hiding an egg under a bench. Am I missing something simple? Guessing it’s something related to the egg having location “out of play”. First bit is from #233 in the Recipe Book:

Underlying relates various things to one thing. The verb to underlie means the underlying relation. The verb to be under means the underlying relation. The verb to be beneath means the underlying relation.

Instead of looking under a thing which is underlaid by something (called the lost object):
	say "You find [the list of things which underlie the noun]!";
	now every thing which underlies the noun is carried by the player;
	now every thing which underlies the noun does not underlie the noun.

Instead of taking something undescribed:
	say "You don't see any such thing."

A bench is a supporter in Arrow.

A spotted egg is an object. The description is "A spotted egg with a ribbon around it. It looks like someone hid it here for you to find." The spotted egg is undescribed.

The spotted egg is under the bench. The description of the bench is "A beautiful wooden bench in the shape of an arrow beckons you.[if the spotted egg is under the bench] You notice something under it.[end if]"

Instead of looking under the bench:
	if the spotted egg is under the bench:
		say "You bend down and find a spotted egg under the bench!";
		now the spotted egg is described;
		say "You don't see anything interesting under the bench."

After taking the spotted egg:
	increase the score by 10;

Here’s what I get:

Arrow Bench
An attractive spot shaded by a few short but dedicated trees.

You can see a bench here.

>x bench
A beautiful wooden bench in the shape of an arrow beckons you. You notice something under it.

>look under bench
You bend down and find a spotted egg under the bench!

>get egg
You can't see any such thing.

>showme spotted egg
spotted egg - thing
location: out of play
unlit, inedible, portable; singular-named, improper-named
description: "A spotted egg with a ribbon around it. It looks like someone hid it here for you to find."
initial appearance: none
printed name: "spotted egg"
printed plural name: none
indefinite article: none
list grouping key: none

1 Like

You’re right. You’ll need to put the egg in the room, but to prevent it from being discovered, use

The spotted egg is undescribed.

The egg will still be takeable but the player won’t see it.

1 Like

That’s the key. Underlying is a relation you invented, so it doesn’t have any meaning to the world model. Support and containment are special-cased a whole bunch of ways that we can’t duplicate in our own relations.

The egg never had to be undescribed: it wasn’t there. So leave it described and move it to Arrow after the player looks under the bench. It won’t “really” be under the bench, but it doesn’t really matter.

The Hiding Under extension by Eric Eve is a worked-out example of doing something like this.


okay sure, you could do it that way. :slight_smile:

1 Like

@Zed is describing (pun unintentional) the canonical way of handling found objects in Inform. The problem with trying to use described/undescribed is that even if you make the egg undescribed and put it in the room, the player will still be able to refer to it, or “find” it by “take all,” for example. Here’s your example, tweaked in this (Zed’s) way:

ETA: also note “for the first time.” You don’t want the players “grinding” up their scores by repeatedly dropping and picking up the egg. :wink:

1 Like

This is terrific thank you all for the speedy help. I’m curious, are there debugging commands that would help in such a case? I know about rules, actions, showme and gonear but that’s about it. Or are there places in the index (which I haven’t really explored) that would help me troubleshoot such a problem? I’m used to traditional programming languages and much as I like Inform, it can be a bit of a black box where I feel I’m just trying variants randomly until I fix a problem rather than being able to root cause things.

In my experience, the Indexes (ok Indices) are the most valuable thing that beginners tend to ignore for way too long. The usual reaction in something like “Oh, crap, why haven’t I been using this?”

In your case, the World Index (specifically the Map) would have shown your item to be out of play.


I especially find the rule books and actions tabs helpful. “What exactly is the name of the action corresponding to this particular command?” Or “ What’s the order of the rules in the turn sequence rule book?” Are both questions I find myself asking a lot.


So here’s a super weird thing. Playing around with the above code, if I have Underlying relates various things to one thing. in my code and I compile for z8, it compiles ok but when I try to do anything from the game prompt, I get a run-time error about memory management. Does not happen if I build for glulx. I tried an empty game with just that sentence and a basic room def but it did not repro. I rebooted my PC but it still happens. It’s a relatively small game (2200 words). Have not tried to figure out where between empty game and my full game the problem begins but thought I’d ask here before continuing too far down the rabbit hole…

I know astonishingly little about Inform’s memory management, but I do know that 1) the Standard Rules are relatively bloated by old-school standards, so you run out of room to compile to zcode much quicker than you’d think using bog-standard Inform 7/10, and 2) many-to-one relations are among the biggest memory hogs in the language.

Could be that there are some things you can fiddle with in the compiler settings to mitigate this – or maybe rewrite to make it a simple one-to-one relation – but these days the lazy-person’s solution is typically to just compile to glulxe unless you have a strong reason to try to target the z-machine.

1 Like

Thanks Mike, your response prompted me to look at the size of the generated .z8 file yesterday, before I started down the path of the above, and it was an astonishing 322k, for my tiny game. In comparison, the Spellbreaker .z3, which I am currently playing, weighs in at 129k.

1 Like

It’s astonishing if you know the history of Infocom how they had to edit their game text to save space. These days, it’s an embarrassment of riches: “Oh, sure, each drawer can have a four-paragraph description of the contents!!”


Yeah, Inform 7 uses absolutely staggering amounts of RAM by Infocom standards. If you want your game to run on retro machines, like the ones Infocom targetted, you’ll want to use Dialog or PunyInform instead. But the cost of I7’s various conveniences is inefficient use of memory.


It’s amazing that putting an egg under a bench was the thing that led to this. (I’ll go back to my hacky way of doing it before, which was to have a supporter called “under the bench” and to put the egg on that, because for reasons unique to our family I’d like to present the final product as a zfile.)

For context, my game has 18 rooms and 55 things (2233 words).

I made a new game with simply “Bedroom is a room.” and it compiles into a 293k file (.z8). So that’s your starting point…

1 Like

If there’s only going to be one thing under one other thing in the game, a relation is way overkill. You could adapt that example without the memory cost by starting

A spotted egg is a thing.
The spotted egg can be under-the-bench. The spotted egg is under-the-bench.

Then the game is storing a single attribute on a single object, rather than a relation table.


Thanks Andrew. Do you have any high-level suggestions for what I should do to start acquiring that level of knowledge of the internals?

In some ways it’s just knowing the scope of your story. If you have one hidden object in the game, it’s fine to just handle it as one instance.

An Easter egg is a thing.

After taking the hearthrug for the first time:
    now the Easter egg is in the location:
        say "Hey, that lump was actually an egg hidden under there!"

If your game is about an Easter-Egg hunt where a player is searching for a lot of them, you might want to make a more systemic approach such as having an adjective:


That’s all very well as long as you know that a rug by a fire is a hearthrug! :roll_eyes:

1 Like

OMG, you sticklers for namespacing! Yes, of course you need to describe items correctly in your games. :expressionless: which I failed to do :joy:

It’s like when you correct someone’s grammar and make another unrelated grammar error in the correction… :face_with_monocle:

(fixed above)
The hearthrug is a concealer in Study. "A tiny woven HEARTHRUG is laid before the fireplace. There's an egg-sized lump under it.". The description is "It's a small oval rug that goes in front of the fireplace.". Understand "rug" as hearthrug.

1 Like

I remember playing an old game from like the 2002 or 03 Comp where I kept dying to a timed trap in first room because I couldn’t open the dresser listed in the room description… eventually either by trial and error or consulting the walkthrough, I discovered that it was actually implemented as an “armoire” with no synonyms!

(One could make a fun/frustrating Ad Verbum style game where you tell the player there’s something in the location but they need to puzzle out what very specific grammar will work, it occurs to me – gamifying “guess the noun”. Now that I type this out, Ad Verbum already pretty much does this, but there’s room for another take on the concept probably!)