Socrates in your pocket

Six months ago or more, I visited this site with many questions when I first switched from TADS to Inform7. In short order I was told (if a tad more diplomatically) to go away and study the documentation further.

Duly chastised, I went away and studied the documentation further. My pilot project now stands at 17,000 words, just 60 rooms and 138 things, and all of this compiles without complaint, but I still have many refinements to implement in what amounts to the opening region of a far more ambitious whole.

With your forbearance, I bring some of my enduring problems here, but if there is a more suitable site for raising such “entry level” queries, please tell.

For openers, here are a few niggles I have been unable to solve thus far:

Default content reporting

I’m using “brief” room description (and undo disabled), but it doesn’t serve the purpose that I7 declares the contents of everything on first sight (including pockets in clothes, and the contents of those pockets, and the contents of those contents). It doesn’t suit the purpose either that I7 tells me a closed door is closed, an empty bottle is empty. How do I disable this “lazy man” option, and have the parser disclose no more than I wish it to disclose?

Micro “regions”

I’m guessing the situation arises frequently where a significant artefact (say Nelson’s column) should be both enterable from one direction but present and viewable in all adjacent rooms. We want separate reports when the artefact is viewed from different angles, and elements of it to be visible/interacted with from one direction only, but it does seem redundant to declare the “column” as a separate scenery item for each adjacent room. Is there a convenient solution which doesn’t entail incorporating the logic for distant objects? If I declare (say) “the chippe shoppe” as a micro-region to that purpose, is there an economical way to list all the component rooms of that region without (again) redundantly declaring each separate room as in “region X”?

Search revealed objects

Some items already appear only once specific scenery elements are examined or searched, by simply moving them into play at that juncture. But in one room I want various fixtures only to be reported once the player looks at (say) the fireplace. Presumably I cannot declare a thing (and its component parts) as scenery or “fixed in place” and then move it into the room at the appropriate moment, but how otherwise do I forbid it being reported?

Compound clothing labels

I need the parser to recognise (for example) “suit of armour” to mean breastplate and helmet and gauntlets when these separate items are all present in a given location, or all worn by the player. How do I declare “suit of armour” as a compound noun for those specific items, and not simply as a synonym for any one of them?

Magic pocket

One of the wearable items has a magic pocket. Nothing can be put into that pocket (apart from a hand, obviously) but anything conceivable can be taken out of it – for example a coach and horses, a Viking ship or Socrates. However, while the parser registers the pocket as a container, I’ve been unable to find a syntax to disable the “putting into” action for anything but the wearer’s hand.

To be exact, I’ve tried disabling it with all permutations of the following: ““[Before / Instead of] putting [anything / something / a thing] [in / into] [a / the] majick pocket, say “Xxxxx” – and none of these is recognised as valid. I don’t quite understand why not? If I declare the holding capacity of the pocket to be 0, will the player still be able to put his hand into it?

Trusting you won’t find these queries too elementary. I thought it easiest to keep them all in a single thread rather than spray them out as individual threads. Any kindly advice much appreciated.

As for the magic pocket, try “inserting it into” instead of putting.

Something like

Before inserting something into the majick pocket:
    if the noun is not the player's hand:
        say "You can't put it there!";

should work for you.

Or you might create a new action (Putting a hand into, perhaps?) that would only work with “put the hand in [majick pocket]” command.

Those pieces of information come from two different places. The “closed” stuff is from the room description details activity; the contents listing can be turned off when you print the name of something. So to get rid of both:

[code]The Testing Lab is a room.

The basket and the bottle are containers in the Testing Lab. The bottle is closed and transparent. It contains a genie. The basket is open. It contains a breadfruit and some Mexican sweet bread.

Rule for printing room description details: stop.

After printing the name of something while looking:
omit contents in listing.[/code]

I’m not quite sure what you have in mind here when you say “doesn’t entail incorporating the logic for distant objects” – if you want something to be seen but not touched, you’ll have to include some kind of code to enforce this. The “Carnivale” example does that by changing the way scope is handled.

If that method isn’t what you want, another way handle this is to make one Nelson’s column object that is interactable-with and physically present in Center of Trafalgar Square, and then a view of Nelson’s column backdrop. I’d then put the backdrop in the mini-region or room list where it’s supposed to be visible, and write a rule to make that view object untouchable.

You can make something scenery and move it in your code. It’s only the player who can’t move a scenery thing.

That’s not at all an elementary question – it’s possible but requires some work.

Depending on how exactly you want it to function, you might find “Left Hand of Autumn” or “AARP-Gnosis” helpful, though I suspect there may be some additional gotchas about using these techniques on wearable items. I’m afraid I’m not in a position to put together an example case for you right now, but possibly someone else will be able to; or you can experiment and come back if you run into problems.

Very grateful to Birion and Emily for replying so promptly and helpfully.

The point of the compound noun glitch is that I want to block the player entering certain locations or utilising certain things if he/she is not wearing (the appropriate costume). Making it a single item (like a tracksuit) would have been the easy answer, but assembling (say the spacesuit) from component elements seems more realistic and intuitive. Surprised this has not arisen before.

Similar niggles -

Don’t sit on the Brazen Bit

The Brazen Bit can be stood on to feast from the damson tree, but it must also be carted off to feed the troll’s baby. By making it an “enterable supporter” it can be stood upon, but the parser gets snooty about a movable enterable supporter. Also, how would I make it possible to stand on supporter X but not sit on it, or sit on supporter Y but not stand on it, if both “sit” and “stand” are translated as “enter”? (That’s probably an easy peasy one, sorry.)

Telescoops and Magnifrying Glasses

And so is this one, I daresay: The player will want to “look through” such portable items, but on the face of it that action is reserved for such fixed items as windows, which are in fact specialised doors. If I write a special code for handling such items, won’t it interfere with the default spec that this is a window-specific activity?

Is it a bird? Is he a plane?

This one’s more pernickety. Nice word, pernickety. I have defined a certain animal with the gender appropriate to its name and function, yet the player should be allowed to refer to it as “it”. This is not allowed. If a game were to incorporate an android or replicant, the neuter form should also be interchangeable with the notional gender. The game may refer to (Skippy) as “him”, but the player may still default to “it”. Interestingly, what I found was that the parser ignores “it” as designating (the coelocanth or whatever) and assumes another inanimate object present in the location, even when this has not been examined or interacted with at all. This might surprise the player: “PICK UP DOG” - “TAKEN” - “WASH IT” - “I SEE NO PURPOSE IN WASHING THE HAND-SPUN SHROUD”

The first post sounded like you wanted the player’s command TAKE ARMOUR to equal TAKE BREASTPLATE, HELMET AND GAUNTLETS and so on, but this sounds like you need to handle multiple items as one in the code. The latter case you can solve quite easily, for example:

[code]Definition: A person is armoured if he is wearing the breastplate and he is wearing the helmet and he is wearing the gauntlets.

Instead of taking the sword when the player is not armoured:
say “The knight’s code of honour dictates that a sword cannot be carried unless wearing a proper armour.”[/code]

It’s a bit late, so I apologise for any mistakes I might make. Take my suggestions with a grain of salt.

(first taking the grain of salt)

If you want supporters that move, maybe you should take a look at the Ridable Vehicles extension. I can’t promise it’s what you need, but maybe it’ll solve all your worries.

As for sitting/standing on something, I would (once again) suggest making new actions (unless they are already defined, you should spend some time looking through the Index, in fact, you should do it regardless, sometimes it seems to me like I learnt more just searching the Index than reading the Documentation):


Understand the commands "sit on [something]" and "stand on [something]" as something new.
[You want to stop the commands from being part of the entering action.]

Sitting on is an action applying to one thing. Understand "sit on [something]" as sitting on.

Standing on is an action applying to one thing. Understand "stand on [something]" as something new.

Check standing on the Brazen Bit:
    try entering the Brazen Bit instead;

Check sitting on the Brazen Bit:
   say "You can't sit on something so alliterative.";
   rule fails;

With luck, this might do the trick.

Gosh, you people are a Weritable Results Factory, aren’t you. I shall try adding all these solutions to the code tomorrow. And thanks again.

By the bye, not having played other people’s excursions in Inform7, I have no yardstick to measure how verbose mine is becoming. I had extensive experience of text adventures when they were still known as text adventures, but in the current project I am taking the term “interactive fiction” quite literally. This is a book in playable form, rather than a game or puzzle, and hence a large part of the experience will be the delight and amusement the player gets from experiencing and exploring the created world. It is entirely non-linear, highly descriptive and whimsical, but that implicitly demands a high ratio of essentially redundant text (describing functionless or scenery items, dealing with player inputs in character, and explaining the convoluted logic of his surroundings piecemeal as he goes.

Does Inform7 have an effective ceiling (in Glulx mode) to a portable game size - translatable into a maximum effective word count?

Inform doesn’t come with any default definitions for windows out of the box. (Although perhaps you are using an extension that defines windows?) The command “look through” is actually just a synonym for the “search” action.

If you want “look through” to do something else in the context of things like windows and microscopes, you will need to 1) define a new action, 2) define the specific kinds of things that you want the action to apply to, and 3) define the grammar that calls the new action for the new kinds.

Example code will probably make this clearer:

A window is a kind of door.
An optical instrument is a kind of thing. A microscope is an optical instrument. A telescope is an optical instrument.

Peering through is an action applying to one thing.

Understand "look through [a window]" as peering through.
Understand "look through [an optical instrument]" as peering through.

The two understand lines will be checked before the more general line that understands “look through [something]” as searching, so if the noun is a window or an optical instrument, the peering through action will be called first. Of course you can then write whatever code you like to define the results of peering through something.

The behaviour of pronouns is very much governed by Inform’s representation of grammatical gender which is really an Inform 6 Template thing. So I guess this one is pernicky.

I can only think of two ways to make it" refer to ‘hims’ and ‘hers’.

  1. Make all you animals neuter and then add an understand line like “Understand “him” as Fido.” to the male ones and mutatis mutandis to the female ones – alternatively add a an “Understand “it” as the droid.” to all non-human ‘people’. This doesn’t make an understood “him”, “her” and “it” a pronoun though! The words will behave at once as names, not as pronouns, for Fido and the droid etc. and as pronouns, not as names, for everything else – and the practical implications of that, I can’t foresee.

  2. You could hack the I6 Template slightly thus:

[code]Include (-
Array LanguagePronouns table

! word possible GNAs connected
! to follow: to:
! a i
! s p s p
! mfnmfnmfnmfn

'it'      $$111000111000                NULL
'him'    $$100000000000                NULL
'her'    $$010000000000                NULL
'them'      $$000111000111                NULL;

-) instead of “Pronouns” in “Language.i6t”.[/code]

(In Inform 6 the exclamation mark comments out the rest of the line. So you can safely skip all of the lines that begin with an “!” in their entirety.)

“GNA” means ‘GenderNumberAnimation’, pronouns can refer to things that are animate (a) or inanimate (i); singular (s) or plural §; male (m), female (f) or neuter (n). A “1” means that the pronoun of the row can refer to the relevant kind of things; a “0” that it can’t. So “them” here refers to anything that is plural (place 4-6 and 10-12 in the array);“him” only to something animate, singular and male (place 1); “her” only to something animate, singular and female (place 2); and “it” to anything that is singular (places 1-3 and 7-9). (Thus in the original I6 code the first row reads " ‘it’ $$001000001000 NULL".)

This way is robust, but the drawback is that “it” will thereby refer to anything singular, including not only animals but men and women as well.

I can think of two more. The first, which would use regex and a global flag to basically overrule the pronoun handling, is a bit beyond my brain at the moment, tired as I am. The second is to violate the Pronouns extension as below.

[code]Include Pronouns by Ron Newcomb.

An it-factor is a kind of thing. An it-factor is privately-named.

After doing something to a person (called subject) when the person incorporates an it-factor, change the pronoun it to a random it-factor part of the subject.

Before doing something to an it-factor (called placer):
let X be the holder of the placer;
if the placer is the noun, now the noun is X;
if the placer is the second noun, now the second noun is X;
try the current action instead.

One it-factor is part of every animal.
A dog is a kind of animal.

The hostery is a room. Jim is a dog in the hostery.

Test me with “x it/x jim/x it”.[/code]

Note that the example isn’t what any sane person would call a clean one. Biggest beef right now (which I would try to address had there been time tonight) is that I can’t easily check whether “it” is unset. Without doing that when play begins or indeed when we enter a new room, the “it” placeholder will only be considered the current “it” pronoun after we’ve affected the original.

It’s probably something simple that my half-conscious mind has overlooked, but hopefully, someone will get something useful out of this code.

Okay. This is equally awful, but does fit the bill.

[code]Include Pronouns by Ron Newcomb.

Definition: a person is also-neuter if it incorporates a neuterhood.

A neuterhood is a kind of thing. A neuterhood is usually privately-named.

After doing something to a person (called subject) when the person incorporates a neuterhood, change the pronoun it to a random neuterhood part of the subject.

Before doing something to a neuterhood (called placer):
let X be the holder of the placer;
if the placer is the noun, now the noun is X;
if the placer is the second noun, now the second noun is X;
try the current action instead.

To gender-set:
if he is also-neuter or she is also-neuter:
if he is also-neuter, let X be a random neuterhood part of him;
if she is also-neuter, let X be a random neuterhood part of her;
change it to X.

After looking for the first time, gender-set.
Every turn when an also-neuter is in location, gender-set.

An android is a kind of person. One neuterhood is part of every android.
The park is a room. Bionica is an android. Bionica is female. Bionica is in the park.

Test me with “x it/x her”.[/code]

Really, though, I’d be much happier if gender pronouns weren’t mutually exclusive.