intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Dec 16, 2017 7:44 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Sep 10, 2017 3:12 am 
Offline
User avatar

Joined: Tue Jan 26, 2016 12:37 am
Posts: 30
I have a character in my game who ignores everything you say. I want to replace the default response 'There is no reply' for all possible ways the player might try talking to the character.

E.g. This only works for TELL FRED ABOUT...

Code:
Instead of telling Fred about something, say "Rather rudely, Fred ignores you and continues searching for his hearing aid."


I'd like the same response for any normally-valid entries
ASK FRED ABOUT...
TELL FRED ABOUT...
FRED, HELLO
TALK TO FRED
SAY BOO TO FRED
etc.

I imagine there is a catch-all term covering all types of conversation but I haven't been able to guess what it is. "Conversing" isn't recognised, for example.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 6:39 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
There isn't a built-in catch-all term, but you can define a kind of action as in §7.15 of writing with Inform:

Code:
Asking Fred about something is bothering Fred.
Telling Fred about something is bothering Fred.
Answering Fred that something is bothering Fred.

Instead of bothering Fred, say "message here."


Note that "FRED, HELLO" and "SAY HELLO TO FRED" result in the same action, answering Fred that hello. (If you're not sure what action a command is resulting in, you can type "actions" at the command prompt and then try the command.) Also, "TALK TO FRED" isn't normally valid out of the box; you'd have to define a talking to action and then add it to the kind of action. Also also, you probably want to do something similar for asking Fred to do something like "FRED, GO WEST"; these can't be taken care of in kinds of action but could be done with an "Unsuccessful attempt" rule as in §12.5 of Writing with Inform.

One last thing, the name of the kind of action is "bothering Fred"--you can't take that definition and turn it into rules for "bothering Alice" or something like that. (It might as well be botheringFred, if that makes sense.) You could specialize the message for different characters by specifying the noun, if you want:

Code:
Asking someone about something is bothering.
Telling someone about something is bothering.
Answering someone that something is bothering.

Instead of bothering when the noun is Fred, say "Fred message."
Instead of bothering when the noun is Alice, say "Alice message."


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 8:21 am 
Offline
User avatar

Joined: Tue Jan 26, 2016 12:37 am
Posts: 30
Thanks Matt.

Is there a way I can incorporate telling someone to do something? E.g. TELL FRED TO WAKE UP.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 8:41 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
That's a bit trickier. That syntax isn't understood out of the box, and you probably would want it to convert to the equivalent of "FRED, WAKE UP," which isn't straightforward. It's possible to hack that up (I'm fiddling with something right now), but if the only use you'll have is to have Fred fiddle with his hearing aid, it'd be simpler to just catch it like this:

Code:
Understand "tell [someone] [text]" as telling it about.


Then "TELL FRED TO WAKE UP" will get processed as telling Fred about the topic "to wake up"--but since Fred ignores everything you say, it doesn't really matter what the topic is. (This will still let "TELL FRED ABOUT APPLES" get processed as telling Fred about "apples", in case that makes a difference.)

EDIT: For what it's worth, this is what I was hacking up:

Spoiler: show
Code:
Lab is a room. Fred is a man in Lab. Alice is a woman in Lab.

Asking someone about something is bothering.
Telling someone about something is bothering.
Answering someone that something is bothering.

Instead of bothering when the noun is Fred, say "Fred message."
Instead of bothering when the noun is Alice, say "Alice message."

Understand "tell [someone] [text]" as telling it about.

Telling it to is an action applying to one thing and one topic. Understand "tell [someone] to [text]" as telling it to.

Converting a tell command is a truth state that varies. Command text is some text that varies. The commanded person is a person that varies.

Carry out telling it to when converting a tell command is false:
   now converting a tell command is true;
   now the commanded person is the noun;
   now the command text is the substituted form of "[the topic understood]".
   
For reading a command when converting a tell command is true:
   now converting a tell command is false;
   change the text of the player's command to "[commanded person], [command text]".


I would recommend caution before trying to use that.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 11:49 am 
Offline

Joined: Sun Oct 11, 2015 5:09 pm
Posts: 276
Here's a solution I came up with for TELL (someone) TO (do something), that I've tested in my WIP. It should also be approached with caution:

Code:
Test Chamber is a room. 

A man called Gordon is in the test chamber. The crate is an open container in the test chamber. The crowbar is in the test chamber.

Persuasion rule:
   persuasion succeeds.
   
After reading a command (this is the phrase commands properly rule):
   let N be "[the player's command]";
   replace the regular expression "^(ask|tell|order) (.+?) to (.+)" in N with "\2, \3";
   change the text of the player's command to N.

Test me with "ask gordon to take the crowbar / tell gordon to put the crowbar in the crate / order gordon to jump".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 12:17 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5507
This suffers from the common problem with trying to do action-parsing in an "after reading a command" rule:

Quote:
>north. tell gordon to take crowbar

Kitchen
The Kitchen is a room.

You can see Gordon, a crate (empty) and a crowbar here.

I didn't understand that sentence.


EDIT: I forgot this pitfall:

Quote:
>TELL GORDON TO TAKE CROWBAR

I didn't understand that sentence.


I do not have a better solution on hand, though, I'm afraid.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 1:00 pm 
Offline

Joined: Sun Oct 11, 2015 5:09 pm
Posts: 276
Whoops, you're right.

There are probably other pitfalls as well, but this should take care of the two that zarf found:

Code:
After reading a command (this is the phrase commands properly rule): 
   let N be "[the player's command]";
   replace the regular expression "(?i)(^|(.+?)(then|.))(ask|tell|order) (.+?) to (.+)" in N with "\1 \5, \6";
   change the text of the player's command to N.


You'll still have problems with constructions like ASK GORDON ABOUT HIS TRIP TO THE BEACH. But it's probably a matter of which corner cases you're willing to live with.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 1:43 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
My version does seem to take care of those pitfalls.
"NORTH. TELL GORDON TO TAKE CROWBAR" gets processed as going north and then a telling it to action that gets turned into "GORDON, TAKE CROWBAR."
"ASK GORDON ABOUT HIS TRIP TO THE BEACH" doesn't get turned into a commanding action, because the part between "ask" and "to" doesn't match the "[someone]" token.
"TELL GORDON TO TAKE CROWBAR. JUMP" does get converted into two commands to Gordon, to take the crowbar and then jump, but this is the same as the out-of-the-box behavior for "GORDON, TAKE CROWBAR. JUMP." (It's like "TELL GORDON TO TAKE THE CROWBAR THEN JUMP" which is ambiguous in English.)

zarf, I wasn't sure what your ">TELL GORDON TO TAKE CROWBAR" pitfall was--that seemed to work OK in Mike's code?

Anyway, here's what I have for the test case. And I'm sure there are plenty of pitfalls there. (One thing is that it'll surely break when "[commanded person]" results in text that can't be understood or is ambiguous, but that's a bad situation anyway.) I wouldn't trust it much around disambiguation although this simple case seems to work.

Code:
Test Chamber is a room. 

A man called Gordon Freeman is in the test chamber. A man called Flash Gordon is in the test chamber. The crate is an open container in the test chamber. The crowbar is in the test chamber.

Persuasion rule:
   persuasion succeeds.

Telling it to is an action applying to one thing and one topic. Understand "tell [someone] to [text]" as telling it to. Understand "ask [someone] to [text]" as telling it to. Understand "order [someone] to [text]" as telling it to.

Converting a tell command is a truth state that varies. Command text is some text that varies. The commanded person is a person that varies.

Carry out telling it to when converting a tell command is false:
   now converting a tell command is true;
   now the commanded person is the noun;
   now the command text is the substituted form of "[the topic understood]".
   
For reading a command when converting a tell command is true:
   now converting a tell command is false;
   change the text of the player's command to "[commanded person], [command text]".
   
Instead of telling Gordon Freeman about something: say "You say, 'Did you know about [the topic understood]?' Gordon says nothing, as usual."
   
Test me with "ask freeman to take the crowbar / tell freeman to put the crowbar in the crate / order freeman to jump/ jump. tell freeman to take the crowbar/ ask freeman to drop the crowbar. jump/ tell freeman about my trip to the beach/tell gordon to x gordon/freeman".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 2:51 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5507
Quote:
zarf, I wasn't sure what your ">TELL GORDON TO TAKE CROWBAR" pitfall was--that seemed to work OK in Mike's code?


Probably works in Zcode, but the capital letters foil the regexp in Glulx. Mike's second version fixed that by adding "(?i)".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Sep 10, 2017 4:36 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5144
Location: Burlington, VT
Ah, I see--I tend to type everything in lowercase anyway and forget it can make a difference with that sort of thing.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group