Cards on the table

I was kind of wondering what the general use of tables were in inform and whether of not they are the best way for player conversation.
Also, I haven’t yet found a way to create a table in inform.

Cheers

I tend to use tables quite a bit, although not for conversation (at least not directly; I use Eric Eve’s Conversation extensions, and I have no idea whether tables might be used as part of the inner workings of those extensions).

One situation where I find tables very handy is where I want some random “business” as background color during each turn when the player is in a given room or some other set of conditions is satisfied. This could be handled by something like:

Every turn when the location is This Must Be The Place: Say "[one of] A [or] B [or] C [or] D [at random]".

However, I prefer to do it by placing the text of each of A, B, C, etc. in a single-column table. I then set up the “every turn when the location is This Must Be The Place” rule so that it chooses a random row from the table and says whatever is the entry in that row (I don’t recall the precise syntax offhand, but it’s pretty simple). The reason I like this approach better than using the “[one of] . . . [at random]” formulation is that I can see at a glance what A, B C, etc. are, and its easy to change them or to add new items to the list of possibilities without mucking around with other code.

Robert Rothman

The extension Adaptive Hints by Eric Eve makes good use of tables. I used it in “A Flustered Duck,” and I highly recommend it.

Ok I begin to see. I always thought that they were just for conversations.

I am having a bit of difficulty actually making a legitimate table. I can’t seem to get columns or rows. Is there some sort of ‘table tutorial’?

I use them to declare bunches of objects of a single kind (like the jersey example in the documentation). It’s not something that’s used in every game, but it’s easy for me to look in the tables and see what my current list of weapons or trees or whatever looks like. They’re not so useful once they get broad; too many columns and it can be hard to read in Inform, but it’s easy to cut and paste to Excel and back. If you’re manipulating numbers at all, I also find the Excel export useful.

As for a tutorial . . . hmm. I think the table documentation in the manual (chapter 15, IIRC) is pretty good. I use it a lot because some of the syntax is pretty particular.

If your only problem is physically making columns and rows, just put a tab stop between each column and hit return for each new row. It may come out looking kind of funny but it should work, if you get the tab stops right. (As gravel said, it looks funny enough that you may want to do most of the work somewhere else.)

Sorry if this isn’t your question/isn’t helpful.

That was very helpful.

There is only one thing I don’t know/ am confused about.
I copied a little bit out of the recipe book (don’t worry no plagiarism) just to see a basic conversation using it, but I can’t even get the tables to work.

[code]A person has a table name called conversation.
Instead of asking someone about [phrase entry]:
let the source be the conversation of the noun;
if topic understood is a topic listed in source:
if there is a turn stamp entry:
say “[the noun] told you [summary entry].”;
otherwise:
now turn stamp entry is the turn count;
say “[reply entry][paragraph break]”;
otherwise:
say “[the noun] looks at you in confusion.”

The conversation of Linda Harris is table of Linda’s babel.

table of Linda’s babel
phrase reply summary turn stamp
“murder/crime/death” “I really don’t want to think about that right now.” “She didn’t want to talk about it.” a number
“Innocent/innocence/plead” “I swear! I didn’t do it! The evedence must have been planted.” “She did not kill John.” –
“John/death of John/murder of John” “I really don’t know. He was my friend, he was all of our friends.” “She could hardly say.” –
“friends/friend” “My friends? They were all there when it happened.” “Her friends were there at the murder scene” –

[/code]

I don’t get any error messages when I start the program, but when I say key phrases, (like murder or John), it will only say “Linda looks at you in confusion.”

No clue what the problem is, but the program seems not to recognize the table.

(the table kind of got messed up, but it is using proper syntax.)

I’m seeing a couple of problems here. There may be an Inform bug lurking somewhere in the underbrush, but I can make it run by: (1) changing [phrase entry] to [topic entry] in line 2; (2) changing the name of the first column in the table from phrase to topic.

At this point, all of the topics work except the third one. The problem here seems to be that Inform is not going to let you put spaces into the topic column options. It will be okay with “John” but not with “John/murder of John”.

The other thing is, topic texts must match exactly. So ‘ask linda about murder’ will match the first line, but ‘ask linda about the murder’ will not match. This is why using Eric Eve’s conversation package extensions is a much better idea. When you do that, you can define the murder as a topic object, with synonyms “crime” and “death”, and Inform will be able to figure out that ‘the murder’, ‘the crime’, and so forth refer to that same object.

Also, look at your capitalization. Your summary texts should not begin with a capital, as they’re run into the middle of a sentence.

In this line:

Instead of asking someone about [phrase entry]:

[phrase entry] isn’t doing anything – when you use square brackets outside of quotes, Inform treats the text inside as a comment, which is to say it ignores it completely. In this case it might work out OK, but the standard form is “Instead of asking someone about something.”

I think the reason changing the first line of the table from “phrase” to “topic” works is that you’re checking it with “if topic understood is a topic listed in source.” Here “topic understood” is just the text entered as part of the command – see section 16.5 about “the topic understood.” So you’re taking that text, and you’re checking to see if it’s a topic listed in source (which is a conversation table) – which will only work if one of the columns of the table is actually named “topic.” I guess naming the column “topic” is necessary, because that’s a special case; see section 15.13.

Anyway, the bracketed text outside of quotes is definitely one of the things that’s confusing you here; it’s kind of a coincidence that it compiled at all.

I’m pretty sure it’s considered totally okay to copy straight from the recipe book – that’s what it’s for. (Of course, you should change the output text to better match your own story, but that’s for aesthetic reasons.)