intfiction.org

The Interactive Fiction Community Forum
It is currently Fri Nov 17, 2017 7:45 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 13 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri Jul 14, 2017 8:00 am 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 101
Hi there,

I am fairly new to using tables in Inform 7 and I was wondering how one can use items as topics, so that the player can "ask man about golden watch" and get a reply. I figured I can use the [thing] token:
Code:
Table of Answers
Topic   Answer
"[bourbon]"   "Yes, you are encouraged to drink as much as you like"
"[crystal glass]"   "I filled it up for you, I can fill it up again"
"[bedside table]"   "Mi casa es tu casa"
"[refrigerator]"   "Mi queso es tu queso"
"[drawer]"   "Mi casa es tu casa"
"[cupboard]"   "Mi casa es tu casa"

Instead of asking Colin about a topic listed in the Table of Answers:
   say "'[Answer entry],' Colin replies."

The good thing with this is that, if I have already included an
Code:
Understand "fridge" as the refrigerator

I can "ask Colin about fridge" and still get the right answer.

The problem is that I don't know how to combine multiple items in order to get the same answer (eg "Mi casa es tu casa") without repeating the reply for each different item row. The structure "topic/topic/topic" or "topic" doesn't seem to work with [tokens].

I am also wondering whether I could use more general rules, along the lines of:
Code:
Instead of asking Colin about a container

Any advice?

Thanks,
Giannis


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jul 14, 2017 8:47 am 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2228
Location: US - Central
I think you could add another column of "things", then "instead of asking Colin about a thing in the table of answers..."

I'm not the table guy, but that might work.

Also check out Eric Eve's "Conversation Responses" extension which lets you write "After quizzing bob about the" "After imploring bob for the..." to see if it might help you. It rearranges the asking about and telling about actions, so make sure it doesn't destroy the work you have.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jul 14, 2017 9:40 am 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 101
Mmm, I tried it but it doesn't work. I think what complicates things is that "ask it about" refers to "some text" as the second noun and not a thing.

I did try this, though, which doesn't give an error message, but doesn't work either:

Code:
Table of Answers
Item   Answer
crystal glass   "I filled it up for you, I can fill it up again"
bedside table   "Mi casa es tu casa"
refrigerator   "Mi queso es tu queso"

Instead of asking Colin about something:
   if the second noun is an item listed in the table of answers:
      say "Colin seems perplexed."

Instead of getting "Colin seems perplexed," I get a line break.

Also, multiple entries, like
Code:
crystal glass or bedside table

don't work.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jul 14, 2017 10:06 am 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 101
Actually, I don't know what I did before, but I just figured that this is working:
Code:
Table of Answers
Topic   Answer
"[bourbon]"   "Yes, love, you are encouraged to drink as much as you like"
"[crystal glass]"   "I filled it up for you, I can fill it up again"
"[refrigerator]"   "Mi queso es tu queso"
"[cupboard]" or "[bedside table]" or "[drawer]"   "Mi casa es tu casa"

Instead of asking Colin about a topic listed in the table of answers:
      say "Colin says, '[Answer entry].'"

So, disregard this part of my question.

I am still puzzled about how I can get something along the lines of
Code:
Instead of asking Colin about a container

though.

Any ideas?

Thanks!
G.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jul 14, 2017 9:53 pm 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2228
Location: US - Central
Try

Code:
After asking Colin about a container:

That will make the action succeed but not show any report rules, and you can hook other actions to it as you need to. Or

Code:
Check asking Colin about a container:
     [do stuff] instead.


That will make the action fail and not process any other asking rules.

Code:
colinstress is a number that varies.

After asking Colin about a container:
     say "[one of]Why are you asking me that?[or]You know I hate containers![or]I WILL KILL YOU FOR MENTIONING CONTAINERS![stopping]";
     increase colinstress by 1;
     if colinstress is 3:
          try colin attacking the player.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jul 14, 2017 10:03 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5115
Location: Burlington, VT
I get the feeling that if you want to deal with asking someone about a noun in a sophisticated way, it's best to make a new action that applies to things rather than topics. It won't eliminate your original asking action; any ASK command that can't be understood in terms of an existing thing will get redirected to the original "ask [someone] about [text]" understand line. So:

Code:
Lab is a room. 

Colin is a man in the lab. A table is in the lab. A beaker is a container on the table.

Querying it about is an action applying to one thing and one visible thing. Understand "ask [someone] about [something]" as querying it about.

Instead of querying Colin about a container, say "Colin says, '[The second noun] can contain things.'"

Instead of querying Colin about something, try asking Colin about "[second noun]".

Instead of asking Colin about "table", say "Colin says, 'Hmm, the table.'"

Instead of asking Colin about "pumpkin", say "What pumpkin?"


(Hanon, I don't think what you suggest will work without a new action, because the asking it about action doesn't have a second noun so Inform expects a topic rather than "a container" there.)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jul 15, 2017 12:30 am 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2228
Location: US - Central
Another trick is to make off-stage objects that represent topics.

Code:
A subject is a kind of thing.

world peace is a subject.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jul 16, 2017 2:27 pm 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 101
All of the above sound like good alternatives.

I am currently experimenting with:
Code:
A beverage is a kind of thing. A beer is a kind of beverage. A bourbon is a kind of beverage.

After asking Colin about "[a beverage]":
   say "Colin grins, 'Yes, love, you are encouraged to drink as much as you like.'"

It seems to be working, although it only works for visible beverages. E.g. in my code, bourbon is visible, while beer is closed in a fridge. When I open the fridge, I can ask Colin and get a reply. If I close the fridge again, I get no reply. This is a bit problematic, since if the player has seen the beer, they are entitled to ask about it...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jul 16, 2017 3:35 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5115
Location: Burlington, VT
If you want it to work for any beverage anywhere in the model world, try this:

Code:
After asking Colin about "[any beverage]":
   say "Colin grins, 'Yes, love, you are encouraged to drink as much as you like.'"


If you want to restrict it to beverages that have already been mentioned, you can add an adjective:

Code:
Kitchen is a room. Colin is a man in kitchen.

A beverage is a kind of thing. A beer is a kind of beverage. A bourbon is a kind of beverage. A beverage can be known or unknown. After printing the name of a beverage  (called drink): now the drink is known.

After asking Colin about "[any known beverage]":
   say "Colin grins, 'Yes, love, you are encouraged to drink as much as you like.'"
   
The fridge is a closed openable container in the kitchen. One beer is in the fridge.


Eric Eve's Epistemology extension will handle keeping track of objects that are known to you in this way.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Jul 17, 2017 5:13 pm 
Offline

Joined: Sat Feb 13, 2016 6:26 pm
Posts: 101
Thanks Matt, that's really helpful!

A funny thing happened, though, as soon as I listed "[any beverage]" under "Topics" in the table of replies: every other thing that was included as a topic in the form of "[refrigerator]" etc. stopped working and I get the "no reply" response.

Does this mean that it is not possible to list "[any kind]" along with a specific "[thing]" in the same column, as I've done here?
Code:
Table of Colin's Answers
Topic   Answer
"[any beverage]"   "Knock yourself out"
"[crystal glass]"   "I filled it up for you, I can fill it up again"
"[cupboard]" or "[bedside table]" or "[drawer]"   "Mi casa es tu casa"
"[refrigerator]" or "[kitchen]"   "Mi queso es tu queso"

Instead of asking Colin about a topic listed in the Table of Colin's Answers:
      say "Colin says, '[Answer entry].'"

I then tried to make two separate tables, one for [thing]s and one for [any kind]s, but I got the same results.

What works is separating the two cases, by adding a separate "instead" rule for [any beverage]:
Code:
Table of Colin's Answers
Topic   Answer
"[crystal glass]"   "I filled it up for you, I can fill it up again"
"[refrigerator]" or "[kitchen]"   "Mi queso es tu queso"
"[cupboard]" or "[bedside table]" or "[drawer]"   "Mi casa es tu casa"
      
Instead of asking Colin about a topic listed in the Table of Colin's Answers:
   say "Colin says, '[Answer entry].'"
   
Instead of asking Colin about "[any beverage]":
   say "Colin says, 'Yep, just knock yourself out, luv.'"


So, yes, my question is why doesn't the previous table work?

Thank again!


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: Google [Bot] and 6 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