Using the name of a thing as an imperative verb

For some unknown reason, I was thinking about litter boxes… (I grew up with cats and I love them, but I haven’t had one for almost 40 years.) When the cat littered the floor, the response was to point to the offending litter and say “Box!”. Exactly what this exchange might mean to the cat isn’t the point.

Then, thinking about how Inform handles directions, I realized that something similar is at play. If you say “east”, the parser interprets this as “go east”. (I haven’t found a place in the Standad Rules to account for this, so I assume that this is something that Inform 6 does automatically for us. So Question 1: Is my assumption correct? Or do the Standard Rules have something to say about this?)

Now I have a scenario that works in Version 10.2 of Inform 7:

The box is a container.  The soldier is a thing.

Foo is a room.  The box and the soldier are here.

Boxing is an action applying to one thing.  Understand "box [something]" as boxing when the box is in the location.  Understand "box" as boxing.

Rule for supplying a missing noun while boxing:
	now the noun is the soldier.

Instead of boxing:
	try inserting the noun into the box.

The result is:

Foo
You can see a box (empty) and a soldier here.

>box
(first taking the soldier)
You put the soldier into the box.

So Question 2:
Q2: Can I replace this with a kind? (Something akin to “[container] [something]”…)

I will add that this is purely theoretical. I don’t have anything practical in mind.

Edit: Apparently only one reply can be accepted as a solution. Andrew answered Q1 and Daniel answered Q2. I’ve implemented a simple example based on Daniel’s reply, which I will momentarily post below as a followup.

1 Like

Yes, directions are a special case handled at the I6 level.

2 Likes

Sure.

Understand "[something] [something]" as inserting it into (with nouns reversed).

This is most commonly used to make [thing] mean examining or [room] mean travelling to. But you can also do it with specific kinds you want to be usable as verbs, like spells in Scroll Thief.

2 Likes

Here is a minimal working example (MWE) which uses Daniel’s solution:

The world is a room.  The can and the box are containers in the world.  The apple and the pear are things in the world.

Understand "[container] [something]" as inserting it into (with nouns reversed).

test me with "can apple / box pear / box can".

Here is the output:

world
You can see a can (empty), a box (empty), an apple and a pear here.

>test me
(Testing.)

>[1] can apple
(first taking the apple)
You put the apple into the can.

>[2] box pear
(first taking the pear)
You put the pear into the box.

>[3] box can
(first taking the can)
You put the can into the box.

Enjoy!

1 Like

This probably isn’t a good idea for real-world use, though. "[container] [something]" is going to match a lot of commands that aren’t intended as verbs.

The small leather bag is a container in the world.

>small rock

You put the rock into the small leather bag.

4 Likes

Furthermore, unless it has been fixed for version 10.2, the implementation within the parser of commands which don’t start with a proper ‘verb word’ (so-called verbless grammar) is somewhat buggy and liable to generate unexpected parser errors or even runtime errors under certain circumstances- see here and here

2 Likes

It doesn’t surprise me that there are difficulties related to naming.

There are other potential difficulties as noted in the two threads referenced below by Peter. But, given the two threads, it’s apparent that this isn’t as “purely theoretical” as I thought.

1 Like