Foxaroo project #1: TARDIS Adrift

I forgot about this until today, but now I’ve posted a thread:

I think that’s true of body parts but not of worn things. So “every person incorporates a nose” will create objects called “Tom’s nose” and “Bob’s nose” but “every person wears a shirt” just creates things called “shirt.” At least, that’s what happened in the Index when I did a test case.

Ahh… you must have discussed that in the last thread about this, but I totally forgot! Bummer.

Thanks Felix, matt w and capmikee!

Firstly, bother! I didn’t get an E-mail notification to say that anyone had appended this thread, so I went ahead and experimented and ultimately I was satisfied with this code:

[code]A WorkGarment is a kind of thing. A Shirt is a kind of WorkGarment. The indefinite article is “a”. Dungaries are a kind of WorkGarment. The indefinite article is “some”. Boots are a kind of WorkGarment. The indefinite article is “a pair of”.

A left wrist is a kind of thing. A right wrist is a kind of thing.
A labourer is a kind of person. A left wrist is a part of every labourer. A right wrist is a part of every labourer.

In the construction site is a male labourer called Tom. The printed name of Tom is “Tommy”. Tom is wearing a shirt called Tom’s shirt. He wears some dungaries called Tom’s dungaries. He wears some boots called Tom’s boots. ] To say rundown for (somebody - Tom): say “[if Tom is In WorkGear]Muscle man Tommy is here, in grubby work clothes[Else]Off-duty Tom is here, wearing [a list of things worn by Tom]”. The description of Tom is “[rundown for Tom]”.

[~~~ And then repeated for the other two labourers ~~~]
[/code]
I didn’t know about the gramar “Every person incorporates” though. Thanks matt w, that helps streamline a lot of code! Eg: “Every labourer incorporates a left wrist and a right wrist.”

Now out of curiosity I tried it this way as suggested by Felix: Every construction worker wears a shirt. Every construction worker wears dungaries. Every construction worker wears boots.
And yes, as Felix warned it does produce identically named objects. That’s not necessarily a problem in my game though, because the next puzzle in my (little) game was to persuade the night watchman to open up the suspect’s work locker (or maybe pick the lock). Thus each set of work gear is separated (unless the player is stupid enough to mix them up.) There’s also a possibility that I’d do a replace of the ordinary shirt with a separate one that has the bloodstain and give that shirt it a different name.

Something I would need to know then, is how to write code for an NPC to pick up and put down objets (the game orchestrating so, not the player). I haven’t had much luck there. I’ve tried “Now [NPC Name] carries” to pick up and “Now the [noun] is in the locker” but it doesn’t always work, and I’m not understanding the cause of the problem. Plus if the objects are identically named that makes it even more tricky to manipulate a particular object.

Where do I find examples of the coding to make NPCs pick up / put down?

Matt W, I’ve put your code in a separate project and yes it compiles and runs very effectively. Am I right in assuming that these two lines of code are what enables Inform to deduce which noun the player is referring to?

Understand "[something related by reversed enclosure] 's" as a thing. Understand "my" as a thing when the player encloses the item described.
How do these work? I haven’t done much with the concept of enclosure. What is the function of “related by reversed enclosure” ?

Also, how does the below code work?

After reading a command: let X be indexed text; let X be the player's command; replace the text "'s" in X with " [']s"; change the text of the player's command to X; say "[line break]".
Am I right in reading that this block of code puts square brackets around apostrophes? Effectively what is the goal/outcome of this?

I look forward to seeing the replies in this thread. It would be good to have a standardised extension created for describing NPCs. Goodness knows they’re used often enough in Interactive Fiction.

You are correct. See section 16.16 of the documentation, “Understanding things by their relations,” which is one of the more magical parts of Inform for my money. “Enclosure” relates a thing to anything it carries, wears, or is part of it, or anything that’s part of that, etc.; so if someone were wearing a backpack that contained a watch that had a button as part of it, the person would enclose the button.

But the key thing is “related by reversed enclosure”; this means that “Tom’s” (or “Tom 's”; see below) will match everything that Tom encloses. Tom encloses the wrist, so Tom is related by reversed enclosure to the wrist, so the string “Tom 's” matches the wrist (it is “[something related by reversed enclosure to the wrist] 's”. Or I may have got the reversed enclosure backwards; I usually have to trial and error that.

Then “Tom 's” matches everything Tom encloses, but if you have “Tom 's wrist” it’ll only match the wrist.

No, it just puts a space before the apostrophe-s, so “Tom’s” turns into “Tom 's”. We need to insert the space so Inform can recognize “Tom” and “'s” as separate words; it can’t parse “Tom” as part of “Tom’s” without a space in between them, since the parser works at the level of words. The brackets are necessary because otherwise Inform will turn the apostrophe into a double quote, which is its default behavior when an apostrophe appears at the beginning or end of a word in quotation marks. (Since you can’t put double quotation marks in quotation marks in your source.) The brackets are just the same brackets you use in a text substitution; ['] is a built-in text substitution that gives you an apostrophe no matter where you put it in quotes.

Thanks matt w!

Now before moving on to the next problem I have a little story to share, and I’d be interested to know if anyone has experienced this same frustration.

A section of my code was producing a compilation error (it was a block assigning a new value to the characters, but that’s not really important). I struggled with it for at least an hour, thinking “What am I overlooking?” I was tempted to do the lazy thing and post it here asking for a solution, but I resovled “No, I’m going to solve this myself.”

I created a blank project and began coding the specific section until I had it working. Such was my zeal that I then copied and pasted it straight over the block with the compilation error and immediately saved the file.

Only after having done so, and lost the ability to undo, did I realise that I’d missed out on the learning experience. IE I had no idea what it was that I’d been doing wrong… nuts. So my learning experience was to pay closer attention to my learning experiences. :unamused:

Now my two current problems:

From last week:
Where do I find instructions on how to make NPCs pick up and put down objects? I’ve found that “Now the [NPC] carries” and “Now the [noun] is in” doesn’t always succeed. This is particularly important if I have those three NPCs who are wearing identically named pieces of clothing.

New problem:
Does concealment work on body parts? I want to put a tattoo on the murderer, but not have it visible under the labourer’s work clothes.

Judging by section 3 of the manual, only carried objects can be concealed.

Chapter 3 - Things
3.24. Concealment
“Rule for deciding the concealed possessions”

If it can’t be done that way, there’s two other possibilities I’ve considered.

  1. Making the tattoo a carried object that is part of the murderer’s inventory but is described as being on their body.
  2. Having a “Instead of examining” condition that prevents the tattoo being examined while covered by clothing.

Which is the best approach?

Seems so. And you do know you can have NPCs perform actions with the try syntax?

[code]The Gym is a room.

Bob is a person. Bob is in the Gym. Bob wears a shirt.

A tattoo is part of Bob. The description is “It is the symbol of the Sacred Chao.”

Rule for deciding the concealed possessions of Bob while Bob is wearing the shirt: if the particular possession is the tattoo, yes.

Instead of examining Bob: if Bob is wearing the shirt, try Bob dropping the shirt; otherwise try Bob wearing the shirt.

After Bob dropping the shirt: say “Bob pulls his shirt off, revealing a curious tattoo.”

After Bob wearing the shirt: say “Bob puts his shirt back on.”

test me with "x tattoo / x Bob / x tattoo / l / x Bob "[/code]

Maybe you could give that thread a bump by posting your own thoughts…

Thanks! :slight_smile: I didn’t realise it was as easy as that! :astonished:

So that is the correct way after all…

I originally put these in my code to test:

When play begins: Try Tom taking the widget; Try Tom dropping the watchamacalit.But I received this error:" Problem. You wrote ‘Try Tom taking the widget’ : but I can’t find a verb here that I know how to deal with, so I am ignoring this sentence altogether."

So then when I saw your instruction I took the code and put it in an empty project and it worked just fine. I then fiddled around until it worked in the original project. I think I had a comma where there should have been a semi-colon or something. Beginner’s mistakes, sorry… :blush:

I most sincerely would if I had a grasp of the code. It’s still early days for me in my learning of Inform. I’ve yet to use any of the following “To decide”,“a truth state”,“is an activity on people”,“For…”,“Pronoun enabled is”. Those are all new to me. I understand the ends; a new extension with standards on how to describe NPCs and how they are examined, but the workings of the code are somewhat beyond me at present. I’m waiting to see what more knowledgeable people say so that I can (hopefully) get more of an idea.

This is the error that you’d get if you write “Try Tom taking the widget.” without a “When play begins:” or similar rule preamble, so my guess is that you might have accidentally put a period after “when play begins.”

Punctuation errors can be seriously annoying!

More likely to have been the immediately preceeding line. I have several statements set up after “When play begins” and they were working fine. Since they were working and “Try Tom taking” produced a compilation error it’s what led me to assume that the command itself was incorrect. All working now. :slight_smile:

Felix, found a problem with the code to conceal the tattoo; it’s concealing all the body features. I added a wrist:

[code]The Gym is a room.

A wrist is a kind of thing. A wrist is part of every person.

Bob is a person. Bob is in the Gym. Bob wears a shirt.

A tattoo is part of Bob. The description is “It is the symbol of the Sacred Chao.”

Rule for deciding the concealed possessions of Bob while Bob is wearing the shirt: if the particular possession is the tattoo, yes.

Instead of examining Bob: if Bob is wearing the shirt, try Bob dropping the shirt; otherwise try Bob wearing the shirt.

After Bob dropping the shirt: say “Bob pulls his shirt off, revealing a curious tattoo.”

After Bob wearing the shirt: say “Bob puts his shirt back on.”

test me with "x tattoo / x wrist / x Bob / x tattoo / x wrist / l / x Bob "[/code]

Result:

[code]>test me
(Testing.)

[1] x tattoo
You can’t see any such thing.

[2] x wrist
You see nothing special about your wrist.

[3] x bob
Bob pulls his shirt off, revealing a curious tattoo.

[4] x tattoo
It is the symbol of the Sacred Chao.

[5] x wrist
Which do you mean, your wrist or Bob’s wrist?

[6] l
The Void
You can see a shirt and Bob here.

[7] x bob
(Bob first taking the shirt)
Bob puts his shirt back on.[/code]Puzzling. The statement references the tattoo specifically, so it shouldn’t be covering the wrist as well.

Slap an “otherwise no” on the end of the rule for deciding concealed possessions and it seems to work. That doesn’t seem to be the documented behavior, but I guess you always need the “otherwise no.”

Worked! Thanks matt w. :slight_smile:

…aaaand onto my next set of challenges.

I’ve had to suspend work on my Inform7 projects once again. On this occasion it’s not a lack of time but a lack of health. I’ve had an inner ear infection since late March, the symptoms of which are persistent headaches and a loss of sense of balance. Even just looking at scrolling text on a screen makes me dizzy.

I’m quite annoyed at this turn of events, as it’s a most unpleasant condition in any case, but also because I was making great strides with my various I7 projects, and having a lot of fun in the process.

(My GP put me on antibiotics in March, and when that didn’t work onto stronger antibiotics, for which I’m still now waiting for an improvement).

I’ll post again soon as I’m well enough to resume this hobby.

Ickaroo! Ear infections are bad news - I hope you and your doc can clear it up!

Sorry to hear that. Get well soon.
(I still look forward to that Interactive Goon Show Fan Fiction Game of yours.)

Thanks. It’s rather unpleasant, and not making my life at work any easier either.

That one’s going to be a good couple of years away because I’m working these projects in progressive order of difficulty, with the Goon Show’s cartoon physics being a phenomenal challenge. Thanks for the encouragement though :slight_smile: , and I’m jotting down ideas when they pop into my mind.

SEAGOON>ASK POLICEMAN FOR DIRECTIONS

POLICEMAN: “Take Euston Road!”

SEAGOON>TAKE EUSTON ROAD

GREENSLADE: "You find yourself before a cabbage green two-bob-a-week bedsitter built into a traffic light at the junction of Yourkinyooston. A sign on the door reads ‘Enquiries - Knock here.’ "

SEAGOON>INVENTORY

GREENSLAND: Mr Seagoon, you are carrying:
. The door to your private office
. Two dozen assorted sound effects
. No tea
. A picture of queen victoria, slightly singed around the edges
. A brass statue of an apology

KNOCK ON DOOR

SOUND FX: RAP, RAP, RAP!

GREENSLADE: “The door is opened by a tall vile man wearing an elastic frown.”

GRYTPTYPE-THYNNE: “I’m sorry sir, but you cannot come in here while you’re holding Euston Road.”

SOUND FX: Loud door slam!

SEAGOON>INVENTORY

GREENSLAND: Mr Seagoon, you are carrying:
. The door to your private office
. Two dozen assorted sound effects
. No tea
. A picture of queen victoria, slightly singed around the edges
. A brass statue of an apology
. Euston Road

SEAGOON: "Right now game-player! Take a hundred lines: ‘I must NOT try to guess the end of goon show gags!!’ "

:laughing:

This!

Quick update: I’m booked in with a specialist on the 9th May, and hopefully then I’ll learn what’s causing these headaches and dizzyness, and more importantly if there’s any way to FIX them! :frowning: