People behavior and object parts

I took a break from Inform, and now I’m trying to get back into it. I’m afraid I’m biting off more than I can chew. I’m not especially good at reading or remembering the entire documentation, so I’m sort of winging it.

Basically one idea I’m working on is people behavior. The code so far:

[code]Feeling tracker is a kind of value. 1f specifies a feeling tracker. All people have a feeling tracker. Feeling tracker is usually 1f.

Feeling is a kind of value. The feelings are neutral, suspicious, angry, or hostile. All people have a feeling. It is usually neutral.[/code]

I could actually name these variables better.

I’ll try to put this as simply as possible. The idea is feeling tracker goes up 1 when someone sees the player perform a suspicious action, or down 1 after a few turns. Feeling changes based on what feeling tracker is. At 1, they are neutral, at 2 they are suspicious, etc. The reason for having both is that behavior is dictated by Feeling. Once someone becomes hostile, they don’t become un-hostile, for instance. And they also give the player grief when hostile.
Also, it might take 3 points to go from angry to hostile, not just one category jump with every suspicious action.

  1. What would be the way to associate the feeling tracker with a feeling (whenever feeling tracker changes, alter the feeling so it coincides with the number)?

  2. How would I enforce the behavior (if hostile, then do these actions instead of normal actions)? That’s maybe too broad a question.

  3. Maybe better still: Is this a decent way of doing this at all?

The other thing I’ve been struggling with is parts of an object. I can get it to work in a limited way. This code works:

The top, bottom, and interior are parts of the cabinet. The top, bottom, and interior are open containers. In the top is a sugarfree gum.

We can examine the top and find the gum.

However, trying to make a universal system doesn’t work.
This code is errorless, but does not work:

[code]A searchable object is a kind of thing.
The bottom, top, and interior are parts of a searchable object.
The bottom, top, and interior are open containers.

The safe is a searchable object.
In the top is a foozle.[/code]

There is no foozle, nor does there seem to be a bottom, top, or interior at all.

Thanks for any help!

For your second problem, try this:

[code]The vault is a room.

A searchable object is a kind of thing.
A bottom, a top, and an interior are kinds of container.
A bottom, a top, and an interior are part of every searchable object.
The safe is a searchable object in the vault.
In the safe’s top is a foozle.[/code]

You need bottom, top, and interior to be kinds of container, because there will be more than one–and then you just need to say that one is part of every searchable object. Inform automatically names the ones that are created as part of the safe “safe’s top,” “safe’s bottom,” and “safe’s interior,” as if we had written down “The safe’s top is a top. It is part of the safe” etc. That’s why we can write down “safe’s top,” when ordinarily possessive forms like that won’t be understood.

The effect that your original code has is to create the bottom, top, and interior as unique objects, which then get incorporated into a nameless searchable object offstage. (Checking the World tab of the Index can be very useful in figuring out exactly what your code did in cases like this–I once had a lot of confusion over why some code involving War and Peace was behaving oddly, until I looked at the Index and realized I’d created one thing called War and another called Peace.)

…but shouldn’t the top be a supporter?

Ahh making them kinds of containers makes sense. It’s like they’re labelled proper nouns otherwise. That seemed to do the trick!

Now the thing is, how can I have the player just type “examine safe bottom” instead of “examine safe’s bottom”. That quotation mark would be awfully irritating the whole game. Would the just be an “understand” statement?

I just blanket term any searchable part as a container. That could also include behind an object. I at least don’t want the player to automatically spot something on top of something (at least something high like a wardrobe, where you couldn’t see).

In this case you can use understanding by relations (see section 17.16). The relation between something and its parts is called “incorporation,” so you can write this:

[code]Understand “[something related by reversed incorporation] bottom” or “bottom of [something related by reversed incorporation]” as a bottom.

Understand “[something related by reversed incorporation] top” or “top of [something related by reversed incorporation]” as a top.

Understand “[something related by reversed incorporation] interior” or “interior of [something related by reversed incorporation]” as an interior.[/code]

This lets the player write “x safe top” or “x top of safe.” Basically that token says “if the player writes the name of something that a top is part of and then the word ‘top’, it means the top.”

I tested it and if you change the top to a supporter (and put the foozle on the safe’s top) the top doesn’t automatically show up in the room description. I think the rule that makes things on supporters show up in room descriptions only applies to scenery supporters (it’s the “describe what’s on scenery supporters” rule)–the safe’s top isn’t scenery, even if the safe is, so the contents of the top don’t get autodescribed. If you did encounter a problem like this you would be able to modify the rule not to apply to tops, anyway.

The reason I recommend making it a supporter is that if it’s a container, searching the top gives you the message “In the safe’s top is a foozle.” That seems strange. If it’s a supporter you get “on the safe’s top is a foozle” which is more natural.

By the way this approach will create a lot of complications–you probably need to make sure that the player can put things on searchable items (and they wind up on the top), that they can put things in searchable items (and they wind up in the interior), and that looking under a searchable item gets redirected to searching its bottom. You’d also want to rewrite the message for examining a safe’s bottom so it said “Under the safe’s bottom is a foozle” rather than “In the safe’s bottom is a foozle,” probably.

There was an old extension, Underside by Eric Eve,
that took care of putting things under things, but I don’t know if it’s updated for the latest Inform.

With regards to the first problem, defining the ‘feelings’ as adjectives on a scale allows you to associate them with the ‘feelings tracker’, like so:

[code]Every person has a number called feeling.

Definition: A person is neutral if their feeling is 0 or less.
Definition: A person is suspicious if their feeling is 1 or more.
Definition: A person is angry if their feeling is 2 or more.
Definition: A person is hostile if their feeling is 3 or more.[/code]
Only odd thing is you’ll need to refer to “the feeling of [an actor]” when you’re manipulating the number, rather than “[an actor]'s feeling”.

As for enforcing NPC behaviour, ‘when’ is your friend. You can attach it with a conditional statement (such as [an actor] is suspicious) to the end of every turn rules and action rules to produce rules that only fire when that conditional statement is true. Such as:

Instead of eating something edible when the guard is suspicious, say "'Put that down, your little rat!' The guard shouts as they jab you with their spear.";

EDIT: With the insight only gained by a good night’s sleep, I realize that the “or mores” in the definitions will cause the adjectives to stack up on the person. So you can probably drop them and it’ll work smoother.

Thanks again for the help. I’m understanding things decently, but the deeper I go, the more I worry Inform is over my head. I suppose I could write a forum post for help with EVERY step of my project, but that’s probably the point I should realize it’s time to give it up.
Anyway, I’ll keep at it for now. I’ll work with this stuff and see what comes of it.

Since I’m doing a range, I’ll probably need to keep something similar to “or more”.
From 1 to 3 will be suspicious. So they are suspicious if more than 0 and less than 4? I think that works right?

If you use “or more” then you might end up with someone being angry AND suspicious AND hostile, but more and less working together sounds like a plan. :slight_smile:

Giving up on Inform doesn’t sound like a plan. It doesn’t look like it’s over your head, but you, like all of us here, have more to learn. That’s not a bad thing, it’s a great thing. More learning is brilliant, it keeps your mind moving, which is the best way to be!

Thanks for the support.
My problem is, you could look at a problem I have and easily say “Didn’t you read the entire documentation? Don’t you know this falls under Chapter 14.2?” Well no. I can’t read the documentation from start to finish, and even if I did, I can’t retain the information THAT well. It’s more a matter of not being academic. My mind is so flighty. But this is a style I grew up with, something I’m familiar with. So, I’m not giving up yet, but I’m awfully close.

Although I’m not going to be one to say “What, didn’t you RTFM n00b?”, I would like to point out that the documentation is written especially to be read from start to finish - you don’t have to, but I’ve always found that it read very nicely. It’s not a reference manual; it’s written more narratively.

Of course, several people do have issues with Inform’s default documentation, and there are several tutorials and guidebooks around (maybe you’ll want to give those a try?), so I’m not saying you should just stick to the default docs and read them in order. Just would like to point out that they were conceived to, up until a certain point, be read through, tutorial-like, and reading the documentation from start to finish isn’t that much of an oddity.

Personally, I read it in order, tried examples, mucked about with them. I didn’t retain the information too well at first, but I7’s default search engine was my big friend there. Didn’t do me much good 'cause I never actually made anything, but hey! :smiley:

Hi, I realized that when I say something like (see section 17.16) it might come across as saying “Didn’t you read section 17.16?!” That’s not my intention! I definitely understand that most people aren’t going to read the whole documentation when they’re picking up the language, and no one is going to retain all the information and where everything is. Often some fairly crucial information is tucked away somewhere where you wouldn’t expect it.

So what I’m trying to do is just say something like “If you want to read the official explanation instead of whatever hurried thing I said, here’s where to look.” I don’t expect anyone to come up with that right away.–Also the Understanding by Relations thing I was suggesting is fairly advanced, and in general the “Put a top and bottom in everything of a certain type and make it possible for the player to refer to them in several ways” thing you’re trying to do is also fairly advanced, so don’t think it’s your fault that you’re not figuring out how to do it right away, or that you need to ask for help with it.

If you want a startup guide to Inform 7 that’s much more accessible than the documentation, have you looked at Carolyn VanEseltine’s QuickStart guide? It takes you from zero knowledge of I7 to implementing a lot of different common kinds of things you’d want in Inform 7, by working through parts of an implementation of Adventure. I don’t think it’ll get you to fancy Understand statements like we’ve been talking about, but at least it’ll let you know that that is fancy stuff.

When you’re confused about something, look for an index reference and read a couple of sections. If you can’t find what you’re looking for, you’ll still have read a couple of sections, and you might remember them next time.

By the time you finish a decent-size Inform game, you will have read at least half of the manual, piecewise.

(In the Inform 6 days, I told people that by the time they finished a game, they will have read the entire manual piecewise. Twice. This is no longer true in I7 – there are advanced topics. I don’t expect anybody to care about “Advanced Phrases” unless you have a yen for functional-style programming. But the basic stuff, yeah.)