(driving me nuts) Talking to invisible people???

So I’m wondering how to get a player to still be able to communicate in the dark. I thought It would be a simple matter, but it’s not.
Here’s what I have:

Asking someone about something is speech. 
Telling someone about something is speech. 
Answering someone that something is speech. 
Asking someone for something is speech.

Visibility rule when in darkness:
	if speech:
		there is sufficient light;
	there is insufficient light.

It still doesn’t let me speak to a noun unless the that noun is visible.

I mean, I would even be willing to make that noun visible in the dark if I knew how to do that. Any ideas?

The visibility rules only run for actions that are defined as requiring light. The reason speech doesn’t work here is not that it is so defined but that objects in dark rooms are considered out of scope. Therefore what you need is an ‘After deciding the scope of’ rule (see Ch. 17:27).

I would have expected something like this to work:

After deciding the scope of the player while speech when in darkness: repeat with neighbour running through people in the location: place the neighbour in scope.
But apparently it doesn’t …

The problem here is that everything is taken out of scope when the player is in darkness. I know that in the Inform 6 code underneath Inform 7, darkness is actually a room in its own right so it could be because you’re not actually in the room you think you’re in.

You can fix this by adding this.


After deciding the scope of the player:
if in darkness begin;
repeat with item running through things enclosed by the location of the player begin;
place item in scope;
end repeat;
end if.

You’ll also find that “speech” is actually allowed by the basic visibility rules. Here’s the code in action.


"Test"

After deciding the scope of the player:
if in darkness begin;
repeat with item running through things enclosed by the location of the player begin;
place item in scope;
end repeat;
end if.

The Testing Room is A Dark Room.

Mr Monkey is a person in the testing room.

Test me with "ask monkey about dark / tell monkey about dark / say hello to monkey / ask monkey for self".

Hope this helps.

climbingstars, your solution works. The only problem is now is I need to get it do it without saying the person’s name first. I think that should not be a problem.

I think adding this should work.

Understand "unknown person" as Mr Monkey when in darkness.

Then “say hello to unknown person” will work, but only when the player is in the dark. Removing “when in darkness” will allow it to work in the light as well.

Hope this helps.

A problem with the proposed solution is that probably places too much in scope: not only persons, but things in general; not only things that would be visible if the room were lighted, but also things inside closed, opaque container; and not only for the speech actions, but for actions in general.

couldn’t i fix that by replacing things with persons?

After deciding the scope of the player:
	if in darkness begin;
	repeat with item running through PERSONS enclosed by the location of the player begin;
	place item in scope;
	end repeat;
	end if.

that would fix the problem i believe

That does work, however you can say “people” rather than “persons” as inform understand it as the plural form.

True, however I would probably use this variation.

After deciding the scope of the player:
if in darkness begin;
repeat with item running through things enclosed by the location of the player begin;
if the item is not in a closed container, place item in scope;
end repeat;
end if.

This way items on supporters can be interacted with as well as various other items in the room.

However, if this is only needed for communicating with NPCs, then “running through people” is sufficient.

Hope this helps.

The main problem is that the rule puts people in scope for any action. It lets the player interact with others in a dark room in any old way, not only by speech – attacking, touching, and taking e.g. will all work as if the room was lighted.

However, it would seem that a rule such as

After deciding the scope of the player while speech when in darkness: repeat with neighbour running through people enclosed by the location: unless the neighbour is in a closed container, place the neighbour in scope.
does work after all.
Only, the rule preamble doesn’t allow conditions on the form

After deciding the scope of the player while telling something about

Instead, you have to write just

After deciding the scope of the player while telling

So, if you add the following definitions

Asking is speech. Telling is speech. Answering is speech.
then the rule above will compile and work nearly as intended. The remaining problem is that ‘asking is speech’ is interpreted only as “asking it for” and never as “asking it about”.

Here’s a workaround:
Define a new action for the “ASK X ABOUT Y” commands, define it as speech, and redirect it to the good old asking it about action.

[code]Querying it about is an action applying to one thing and one topic. [You have to create the action before you declare it speech.]
Understand “ask [something] about [text]” as querying it about.
Check querying it about: try asking the noun about the topic understood; stop the action.

Asking something about something is speech.
Telling something about something is speech.
Answering something that something is speech.
Asking something for something is speech.
Querying something about something is speech. [We can add this as well, while we’re at it.]
Asking is speech.
Telling is speech.
Answering is speech.
Querying is speech.

After deciding the scope of the player while speech when in darkness:
repeat with neighbour running through people enclosed by the location:
unless the neighbour is in a closed container, place the neighbour in scope.[/code]