Simple table problem

Dear all,

I don’t get behind the concept of tables.

Table of example
Name Flag
“Anton” 1
“Berta” 0

I want to know whether Flag for “Berta” is 0 or 1, and I want to check it by the name, not by the row number. Like, if the Flag entry for “Berta” is 0, I want to say “Test”. How do I achieve this?


This isn’t necessarily a situation requiring tables.

You can give things numbers or properties (without using a table). You can change these and test them later. Here’s a demo:

Lab is a room. "JUMP to set Berta's flag to 1.".

A person has a number called flag.

The flag of a person is usually 0.

Berta is a woman in lab.

Anton is a man in lab.

Instead of jumping:
	now flag of Berta is 1;

Every turn when flag of Berta is 1:
	say "TEST! (i.e. the flag of Berta is 1)[line break]";

Test me with "z/jump/z".

I used an every turn rule here, but you can put in code in particular situations like:

if the flag of Berta is 1:
	do so-and-so;

This might help. If it’s not what you were hoping for… someone else will probably help. I’m going to bed!


Yeah, tables are pretty gnarly in i7. If you’re just looking to have flags, Wade’s solution is right, but if you’re looking specifically for a starter syntax on Tables, this might help :

Garden is a room.  "[example_function]"

Table of Example
Name	Flag	Output
"Berta"	1	"Test1"
"Jack"	0	"Test2"
"Bob"	1	"Test3"
"Cheryl"	0	"Test4"

To say example_function:
	[To just set a Flag value for a specific name]
	now Flag corresponding to a Name of "Berta" in the Table of Example is 0;
	[To check a flag value]
	if Flag corresponding to a Name of "Cheryl" in the Table of Example is 1:
		say "Test.";
	[A different way, if you wanted to use multiple columns]
	choose row with a Name of "Berta" in the Table of Example;
	if Flag entry is 1:
		say "[Output entry].";
	[or if you wanted to cycle through the table and print the output of every name with a flag of one, an easy way is]
	Repeat through Table of Example:
		if Flag entry is 1:
			say "[Output entry].".

Hope that’s useful



Thanks Ade, that worked! I did of course check the dosumentation but I did not sumble across the “corresponding to a” bit.

Also thanks Severedhand, I do know flags from Inform 6 and they’ll come in handy for me here, too.