Supplying or querying "ask" target when topic is known

There are a bunch of people in the scene, and I’d like this either to prompt the player to choose who to ask, or to automatically supply one of the people as the ask target. But I think the parser is reading “about soup” as a person to query? (In the real non-soup version, there’s already a rule I wrote for asking someone about soup, but I’m also planning to write in more topics using a table.)

I read the bit of the manual about supplying nouns, but I’m not sure what I’d need to do to get it to understand “ask about [text]” as “ask [someone] about [text]” and either supply or ask for the first noun.

Yes, that is a slightly misleading message. It can be interpreted as meaning the soup.

One potential solution would be to change the can’t see any such thing message to something along the lines of “You can’t see anything called ‘[noun]’ nearby.”

One rule of thumb (courtesy zarf) about supplying nouns etc. is that it’s meant to be kind of convenient, and if it doesn’t work the way you want the first time, it’s better to just make up an action that suits the form.

So if you want you could define a new action, like “vaguely asking,” for “ask about [text].” Then you could write a rule for that action that tells the player to type “ASK [someone] ABOUT THAT THING,” or you could write rules to pick someone automatically and then try to ask the person about the topic understood.

Eric Eve’s Conversation Framework and related extensions have lots of rules for keeping track of who you’re talking to so “ask about soup” automatically gets redirected to that person, but I should mention that Hanon and I and eighty other people just did a massive collaborative project that used those extensions, and I think the consensus was that next time we wouldn’t use those extensions. Though it might have been harder to deal with the parts where there was more than one person in the room because the person who coded one of those people weren’t talking to the person who coded the other in advance.

HanonO, that’s not really the issue I’m trying to solve - when I ask about a topic in a room filled with people, I’d like the parser to prompt me to either choose a person to ask about the topic, or choose for me. (Automatically supplying the only other person in the room would probably be good in other parts of the game where there’s only one other person, so if there’s a blanket way to supply someone, it’s probably fine if the parser picks for you in this big room too.)

matt w, yes, I was actually trying to create a “vaguely asking” in exactly that phrasing! I’d prefer to avoid asking the player to retype commands where I can avoid it, though. Assuming that “vaguely asking” is “asking about [text]”, is there any “instead of vaguely asking, try asking another/the other person in the room about the topic understood…” I can put in here?

Thanks for the tip about Conversation Framework - I’d been about to look into it for a later part of this game.

Sure, you can just use a rule to redirect the action.

[code]Definition: a person is NPC if it is not the player.

Asking vaguely about is an action applying to one topic. Understand “ask about [text]” as asking vaguely about.

Check asking vaguely about when no NPC person is visible: say “There’s no one around to ask.” instead.

Check asking vaguely about when two NPC persons are visible: say “You’ll have to say who you want to ask, for instance ‘ASK [random visible NPC person] about [the topic understood].’” instead.

Carry out asking vaguely about: try asking a random visible NPC person about the topic understood. [since the Check rules stop the action if there are zero or two or more NPCs visible, this only happens if there is one visible NPC–and the random check is guaranteed to pick that one][/code]

Another thing that might be nice, which Conversation Framework handles, is to keep track of the current interlocutor so if you’re talking to one of two visible NPCs you can automatically redirect asking vaguely about to that NPC… but that’s a little more complicated.

Hm, the parser isn’t liking this…

I added the code you’d recommended (even though I was using “other” for what you’re using “NPC” for - I just wanted to make sure I was reproducing what you had). What am I missing?

Hmm, I don’t know. I actually did test this one! The following code compiles under 6M62:

[code]The Market is a room.

The street food is a plural-named thing in the Market. The printed name of the street food is “buns and soup”.
Understand “buns”, “bun”, or “soup” as the street food.

A vendor is a kind of person. Understand “vendor”, “vendors”, “merchant”, “merchants”, “sellers”, or “seller” as a vendor.

A vendor has some text called the disambiguation tag. Understand the disambiguation tag property as referring to a vendor.

The description of a vendor is usually “Another day or night, [regarding the noun][those in the nominative] might be hawking [their] wares. Not tonight.”

The bun-vendor is a male vendor in the Market. The printed name is “bun vendor”. Understand “bun vendor” as the bun-vendor. The disambiguation tag of the bun-vendor is “bun”.
The soup-vendor is a female vendor in the Market. The printed name is “soup vendor”. Understand “soup vendor” as the soup-vendor. The disambiguation tag of the soup-vendor is “soup”.

Definition: a person is NPC if it is not the player.

Asking vaguely about is an action applying to one topic. Understand “ask about [text]” as asking vaguely about.

Check asking vaguely about when no NPC person is visible: say “There’s no one around to ask.” instead.

Check asking vaguely about when two NPC persons are visible: say “You’ll have to say who you want to ask, for instance ‘ASK [random visible NPC person] about [the topic understood].’” instead.

Carry out asking vaguely about: try asking a random visible NPC person about the topic understood. [since the Check rules stop the action if there are zero or two or more NPCs visible, this only happens if there is one visible NPC–and the random check is guaranteed to pick that one]

Fair is north of market. The barker is a man in Fair.

Alley is north of Fair.[/code]

This is kind of silly, but if you’re using “other” where I had “NPC,” what happens if you change “NPC” to “other” in the line that’s producing the error?

No, the problem was the same, unfortunately - it’s not parsing ‘visible other person about the topic understood’. (It also fails if I remove “visible” and “other”, leaving the line as “try asking a random person about the topic understood.”)

Your code works fine for me if I dump it into a test file, so obviously something else I have is creating a problem. I started commenting out different parts of my code to see what it was, and TURNS OUT it was this -

Asking is an action applying to one thing. Understand "ask [someone]" as asking. Carry out asking: say "You realize that you should try asking [the noun] about something in particular.";
which I’d put in way back to avoid the default “What do you want to ask the bun vendor for?” response (no one really needs to ask anyone for anything in this game). Any idea what I need to do to solve both problems?

Hmm, it seems like the Inform compiler shouldn’t choke on that, but I guess it does. Still, you can fix it by renaming your other action to keep “asking a random visible NPC person about the topic understood” unambiguous:

Asking subjectlessly is an action applying to one thing. Understand "ask [someone]" as asking subjectlessly. Carry out asking subjectlessly: say "You realize that you should try asking [the noun] about something in particular.";

Fair point! Looks like that’ll do, if it causes any further problems down the line (I think I fixed all the places where I’d written “instead of talking to or asking” and “try asking”, but I didn’t playtest all the cases) I’ll update here. Thanks!

Further note for posterity: the scene also has a specific person with some other responses that I only want the player to be able to query directly, rather than randomly. I ended up handling this with an “unasked” property and a while loop, but it could probably be done better. [edit, actually it definitely could have been because it’s stalling out the first time I ask vaguely, I don’t know why I thought it was working to start with]

Is it possible that you have a mismatch between properties somewhere? Like, if you have a test which is “If there is a visible other person…” and then you do something like “a random visible other notthatparticularperson person” there’s no guaranteed that there will be a visible other notthatparticularperson person.

Or if you’re using a while loop you have to check that it’s absolutely sure to terminate of course… like if you are trying to choose a random person until it’s not that one, and that one is the only available person, you’ll get an infinite loop.

They’re not the only available person in the scene and this is the only action that specifies visible people in the code. Should I be adding another property, even if it’s clunky to do so? (Like, “a person is usually available” and mark that person specifically as not available, and ask a random visible available NPC…)

[Edit again, sorry, getting into other parts of the game; one other character is in-scope even when not in the room for other reasons so I was just figuring I’d mark them as not available so they don’t get asked, but that screws with the player trying to ask vaguely when they do end up in the same room. Is there a way I can make them in-scope for remote action but not “visible” for this purpose?]

Oh, if you want characters that are in the room rather than characters are in scope, change “visible person” to “person enclosed by the location.” I was thinking of suggesting that anyway, because checking visibility lots of times is computationally expensive and can lead to loops if something gets screwy, but it sounds like “person enclosed by the location” is definitely what you’re looking for.

(“The location” is the room the player is in. “Enclosed by” rather than “in” because “in” only gets persons who are directly in the room rather than on supporters, etc.)

If you want to randomly choose someone but exclude one person I think the best thing to do is probably to make another adjective. You might be able to do that with a definition: “Definition: A person is available if it is not Chun the Unavoidable.”

If none of that works, maybe you can post an excerpt of the code that’s causing the problem?

Thank you! I think that works, but I’ll post again with any issues.