Characters without bodies?

Hi everyone, I’ve just started writing IF and I absolutely love it. However, I’ve run into a bit of a snag with my first experiment. The story takes place on a space station and there’s a friendly AI that fills most, but not all, of the ship. How can I make this work out? Can I make an NPC invisible and capable of moving freely through locked doors? Thanks for your help!

Instead of moving the AI around you could try putting the AI in scope in the locations where you want it to be. Here I’ve made an adjective that you can set to those rooms where you don’t want it.

[code]AI is a person.
A room can be AI-free. A room is usually not AI-free.

After deciding the scope of the player:
if the location is not AI-free:
place AI in scope.[/code]

If I were to make an invisible near-omnipresent NPC, I’d do it in several stages:

First, you probably want to make the relevant person “scenery”, so that it does not appear in room descriptions.

Second, you want to write a set of rules defining where the AI is. Does the AI ever need to be anywhere other than where the player is? If not, then you can just move the AI to wherever the player is whenever the player goes somewhere, but block that rule if the player is going into certain rooms (see chapter 8.9 of the documentation on moving the player, and then all of chapter 12 for lots of the details on moving NPCs around).

Finally, you’re going to want to block certain actions to do with seeing and touching the AI. Some of this can be accomplished through the rules for visibility and touchability and so forth (see 6.13 and 12.16-19). However, you’re going to need to think through all the different things the player might try to do to the AI once they learn of its existence, work out if they’re possible to do to a noncorporeal voice, and then write a bunch of rules to implement them.

Hope this helps.

You’re really asking for a backdrop that is a person. Though you can’t have one thing that is both a backdrop and a person, you can have a backdrop that has a part that is a person and then put that backdrop in a region of your spacestation. Like so:

The Lab is a room. North of the Lab is the Hallway. North of the Hallway is the Pantry. The Tattles is a Region. The Lab and the Pantry are in the Tattles. The AI is an backdrop in the Tattles. A person called HAL is part of the AI.

Now it’s possible to interact with HAL in the Lab and in the Pantry but not in the Hallway.

Thanks for the help, guys!

Now, I’ve got the code doing what I want, but I’m running into an error message.

[code]A computer is a kind of thing. A computer is a kind of device. A computer is in every room. A computer is usually switched on.

Definition: a room is habitable if the computer is switched on.
Definition: A room is inhabitable if the computer is switched off.

The network is a backdrop. The network is in all habitable rooms.

A person called Q is part of the network.[/code]

I’m being told that this is no good, because “[habitable room] is now a kind qualified by a property which may come or go during play.” But I want that property to change, because later on, the player is on the run from the AI, and the only way to keep away from him is to turn off the computers. Any way I can get this to work?

Does this work?

Every turn: Move the network backdrop to all habitable rooms; update backdrop positions.

[EDIT: First time I left out “backdrop” from “network backdrop” – that’s necessary, see section 8.8 of Writing with Inform.]

Probably pretty inefficient, though; you might want to do it every time a computer switches on or off instead of every turn.

Also, I’ll bet that this:

Definition: a room is habitable if the computer is switched on. Definition: A room is inhabitable if the computer is switched off.

defines a room as habitable if any computer is switched on, and inhabitable if any computer is switched off. Inform almost always treats “the” the same as “a”; you need some way of telling it that the computer you mean is the computer in that room.

Another point, which doesn’t affect how your code runs but might make it more readable, is that “inhabitable” means the same thing as “habitable,” that is "can be inhabited. You might want “inhabitable” and “uninhabitable.”

This seemed to work for me:

Definition: a room is habitable if it contains a computer that is switched on. Definition: A room is inhabitable if every computer in it is switched off.

By the way, this from your code didn’t work for me:

A computer is a kind of thing. A computer is a kind of device. A computer is in every room. A computer is usually switched on.

For one thing, I7 didn’t like that computer was declared as both “kind of thing” and “kind of device.” When that was out of the way, “A computer is in every room” didn’t actually create a computer in every room – only in the first room. If I read 4.14 of Writing with Inform correctly, you aren’t allowed to use “every room” – you have to make a special kind of room, thus:

A computing room is a kind of room. A computer is in every computing room.

And then I think you have to declare by hand that all your rooms are computing rooms, which is annoying.

I’m using an older build of Inform though, and also am not too experienced, so take this all with a grain of salt which is to say test it yourself.

I’m going to suggest that you jettison the backdrop approach and try Juhana’s solution. The basic code for what you want to do is quite simple:

[code]The network is a thing.

After deciding the scope of the player when the location is habitable:
place the network in scope.[/code]

(Folks are often afraid of “messing with scope,” but it’s really not as complex as the odd terminology suggests. What the code does is not move the network into the room with the player, but simply makes it accessible to the player as if it were there, with some differences. See the manual, chapters 17.27, 12.16, 12.19, 16.7 for most of the details on how this works.)

–Erik

This sounds like the best plan to me. When I was testing the backdroppy code I noticed that the error message for talking to Q in an uninhabitable room was super-unhelpful – the standard “You can’t see any such thing.” Maybe you can use scope to create a better error message, like this?

After deciding the scope of the player: place the network in scope. Instead of doing anything involving Q when the location is not habitable: say "You can only access Q through a switched-on computer."

How does that seem?

I’ve combined the different solutions, but I haven’t been able to test it yet.

A computing room is a kind of room. Every computing room contains a computer.

contradicts with

[code]The Personal Quarters is a computing room.

The Central Hallway is a computing room.[/code]

because it wants to put the same computer object in each room, rather than creating a different computer for each.

EDIT: Copied 4:14’s example word-for-word, I think I’ve got it working now. Had to say “one computer” instead of “a computer.”

It works in 6F95. That is, I have this:

A computer is a kind of thing.

A computing room is a kind of room. Every computing room contains a computer.

The Personal Quarters is a computing room.

The Central Hallway is a computing room.

And that produces two anonymous computer objects.

So I’ve gotten the game to recognize Q as a part of the computer…I think. Any time I interact with Q, even in an inhabitable room, I get the message that I can only interact through a switched on computer. I defined most computers as switched on, and I still get this. Worse, I’m told the computer isn’t something I can switch.

[code]A computer is a kind of device. One computer is in a computing room. A computer is usually switched on.

The network is a thing. A person called Q is part of the network.

Definition: a room is inhabitable if it contains a computer that is switched on.
Definition: A room is uninhabitable if every computer in it is switched off.

After deciding the scope of the player:
place the network in scope.
Instead of doing something to Q when the location is uninhabitable, say “You can only access Q through a switched-on computer.”[/code]

Once again, that problem doesn’t arise in 6F95. I really think you should update.

(I pasted your code into a new I7 project, but also said “The computing room is a room” to make it compile.)

I run into a different problem, however, which is that most verbs (including tell and ask) give a “He isn’t available” error, because Q is untouchable. (Putting something in scope only makes it visible, not touchable.)

Trouble is, I am running 6E95, since that’s the version on the main site. I’m presuming I’m not missing out on a patch or something?

The latest version, available at inform7.com/download/, is 6F95. The previous version is 6E72. Which one do you have? What platform are you running on?

6F95 on Windows 7.

This, I think, is how I would do it.

The only disembodied character in the game is Q, right? And the player will only interact with Q through a computer and by a limited number of commands (ask Q about, tell Q about, perhaps answer Q that, consult Q about, possibly show something to Q), right?

Let’s keep Q off stage altogether and talk to him via the computer terminals. That way we need not bother with putting him in scope or making rooms inhabitable.

Begin as before by creating the computer and computing room kinds:

A computer is a kind of device. A computer is usually switched on. A computing room is a kind of room. Every computing room contains a computer.

Then we create Q but place him nowhere, thus leaving him off stage:

There is a person called Q.

Next we create the actions we need to interact with Q in a way that lets the player interact with things out of scope:

Q-asking it about is an action applying to one visible thing and one topic. Q-telling it about is an action applying to one visible thing and one topic. Q-answering it that is an action applying to one visible thing and one topic. Q-consulting it about is an action applying to one visible thing and one topic.
It’s the “visible” part that does the trick (Q isn’t visible, but some things can be out of scope and still be visible—like elephants at a distance. That, I guess, is the rationale for using that word for actions applying to out of scope things.) Showing it to, by the way, is already defined as applying to one carried thing and one visible thing.

Now we won’t let the player address Q directly, but only via a computer terminal:

Understand "Q" as a computer. Instead of asking a switched on computer about something, try Q-asking Q about the topic understood. Instead of asking a switched off computer about something, say "You can only access Q through a switched on computer."
And mutatis mutandis for the other Q-actions.
So when the player asks Q (who is not present) about something, Inform will interpret that as asking a computer (that is present) about it. But before the computer gets a chance to answer, Inform stops the asking action and replaces it with a Q-asking action addressed to Q instead.

However, Inform 7 won’t let you ask the computer any questions, because it’s not a person. You get around that problem by including a bit of Inform 6-code.

Include (- has talkable -) when defining a computer.

Now, we can talk to computers and via them to Q.

This is what it might all look like.
[rant]A computer is a kind of device.
A computer is usually switched on.
Include (- has talkable -) when defining a computer.

A computing room is a kind of room.
Every computing room contains a computer.

The Personal Quarters is a computing room.
The Passage is north of Personal Quarters and south of Central Hallway.
The Central Hallway is a computing room.

Major Tom is a person. He is in the Personal Quarters.
An apple is in the Personal Quarters.

There is a person called Q.
Understand “Q” as a computer.

Q-asking it about is an action applying to one visible thing and one topic.
Carry out Q-asking Q about “secret”: say “‘I can’t tell you that, Dave’, Q says softly.”

Instead of asking a switched on computer about something, try Q-asking Q about the topic understood.
Instead of asking a switched off computer about something, say “You can only access Q through a switched on computer.”

test me with “ask tom about secret/ask apple about secret/ask computer about secret/ask Q about secret/x Q/n/x Q/ask Q about secret/n/x Q/ask Q about secret/switch computer off/x Q/ask Q about secret”.[/rant]