Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

simple question about printing from tables in inform 7

13 views
Skip to first unread message

jaim...@gmail.com

unread,
Aug 11, 2007, 7:41:53 AM8/11/07
to
Hello--

I'm new to Inform, and I'm learning it on my own as I go. I'm having a
problem with one thing in particular, and I'm hoping someone here
might be able to help. I'm sure the solution is extremely simple, but
I can't figure out what to do.

All I want to do is to print a short sentence of text each turn during
a short scene. I have set up a table containing the sentences I'd like
to use, and I have written an every turn rule for the scene in
question. The problem is that I want each sentence to be printed in
the order in which they are listed in the table, so that, for example:

in the first turn of the scene, the first item in the table is
printed.
in the second turn, the second item is printed.
etc.

I know this has got to be easy to do, but I can't seem to figure out
how to implement it.

Thanks in advance.

Mike

unread,
Aug 11, 2007, 7:59:46 AM8/11/07
to

One solution is to have a current row counter that you increase every
turn. This would be a simple implementation:

<code>
"Test Table" by MC

The Room of Requirement is a room. "The most useful of all the rooms
in Pigmole's School. It shows you all of its previous uses while you
wait."

CurrentRow is a number that varies.
When play begins: now CurrentRow is 1.

Table of Requirements
Sentence
"Originally the room was used as the headmistress's study."
"As the year's advanced, it became the school library."
"Three year's ago, it was used as a torture chamber - actually for
mathematics lessons - but that is much the same thing."

Every turn:
Choose row currentrow in the table of requirements;
Say "[Sentence entry]";
Increase currentrow by 1;
If currentrow is greater than the number of rows in the table of
requirements begin;
now currentrow is 1;
end if.
</code>

jaim...@gmail.com

unread,
Aug 11, 2007, 8:18:07 AM8/11/07
to
Mike, thanks so much. I think this will do the job.


Eric Rossing

unread,
Aug 11, 2007, 9:23:58 AM8/11/07
to
You might also take a look at the extension List Control by Eric Eve,
which does this and a couple similar things.

0 new messages