More Learning About Tables

So I am trying to learn more about tables since they’re giving me such brain hives. Surely they can’t be all that hard. Yet they are.

First question:
In chapter 16.8-- Blank columns, it gives this instruction and example:

Inform is unable to work out what kind of value should go into the "atomic weight" column here, since it has no examples to guess from. We can get around this by writing in the name of a kind of value:

>Table 2 - Selected Elements

|Element|Symbol|Atomic number|Atomic weight|
| --- | --- | --- | --- |
|"Hydrogen"|"H"|1|a number|

The formatting on that C&P sucks. Sorry about that.

I did this in a table where “ordernumber” is a blank column with the first entry being “a number” and the rest of the column is --. But the first column (entrylock) is defined as a kind of thing:

An entrylock is a kind of thing. Some entrylocks are defined by the table of choiceorder.

Inform complains about this:

Problem. You wrote ‘Some entrylocks are defined by the table of choiceorder’ (which asserts that ‘lock A’ is/are ‘a number’ ), but that seems to set a property OrderNumber to the value ‘a number’, which I don’t recognise as meaning anything.

But I haven’t defined entrylocks as a number-- I define them as a kind of thing. And I’ve checked carefully to make sure I didn’t have anything else in the code about defining entry locks. What am I doing wrong here?


Looks like what you need to do is leave all the columns blank, and change the heading to “ordernumber (a number)”.

(I discovered this by banging on the example a couple different ways, and if you just blank out the whole column the compiler error tells you the right answer. Guess they changed the syntax somewhere and the docs haven’t been updated? Gotta love Inform!)

1 Like

AAAAAAAARGGGGGHHHH. It’s hard enough without running into all these places where the docs are wrong.

IFTF should do a not-so-micro-grant to someone to update the docs. It’s a lot of work. Paging @Zed, who has been fighting the good fight here for a long time? Or maybe this is something Dan could do? I’d be delighted to contribute to such a grant.


Ok, second question:

I simply cannot find the syntax for doing what I want. I want to go through the table, find out if an order number is 9 or 10 or 11, etc. If an ordernumber equals a certain number, I want it to print the information in that row.

I have confirmed that the first part of my code is working: I can get the correct ordernumber for a given entrylock to be whatever number I want (that code is long and is elsewhere and works fine, so I’m not including it).

Here’s my table:

Table of ChoiceOrder
LockName	Bookdesc	Memory	    ObjectDesc	 OrderNumber (a number)
lock A	"some textA"	"[memoryA]"	"keyhole A." --	
lock B	"some textB"	"[memoryB]"	"keyhole B"	 --
lock C	"some textC"	"[memoryC"	"keyhole C"	 --
lock D	"some textD"	"[memoryD]"	"keyhole D"	 --
lock E	"some textE"	"[memoryE"	"keyhole E"	 --
lock F	"some textF"	"[memoryF]"	"Keyhole F"	 --

The second part is for the player to be able to remember that information. The first 8 pieces of information are easy because they’re in a prescribed order. The last 6 pieces of information can be discovered in any order, but must be displayed to the player in the the order they are discovered. Here’s my VERY INCOMPLETE code for that, just attempting to print something if an ordernumber is 9 (I have verified that there is in fact an ordernumber of 9 in one of the rows):

Understand the command "remember" as something new. Understand "remember" as remembering. Remembering is an action applying to nothing.

Understand "R" as remembering.

Carry out remembering:
	showme the contents of the table of choiceorder;[this is how I know I have a row with an ordernumber of 9]
	say "A lot of stuff removed here which works fine on its own and covers numbers 1-8 of what players can remember.";
	repeat through the table of ChoiceOrder:
		if there is an ordernumber of 9 in the Table of ChoiceOrder:
			choose row with an ordernumber of 9 in the Table of ChoiceOrder;
			say "[line break][ordernumber].) [memory]";
	say "[paragraph break]To end remembering, press E.";
	now the player is memoried.

Then the player can pick a number and an “after reading a command:if the player is memoried: if the player’s command matches a number” bit of code will allow them to “remember” a big chunk of text.

This code compiles fine, but when remembering gives me the run-time problem I am most familiar with but have the least idea of how to fix:

*** Run-time problem P31: Attempt to use a property of the ‘nothing’ non-object: property ordernumber

The special value nothing is used to mean no object at all, and sometimes appears where an object might be expected if it was impossible to find a genuine object, or no genuine object was specified.

Nothing is not an object in its own right, and so it makes no sense to look at its properties.

This is obviously related to all those blanks in the table where numbers aren’t.

I am trying to work this out piece by piece, so while I am sure this is the wrong way to do this, it’s the way I’m choosing to learn how the whole thing works. Maybe it leads to a working system, maybe it doesn’t. I just want to learn what the deal is with this error message and how I can change the code to eliminate it.

I think your say statement needs to be:

say “[line break][ordernumber entry].) [memory entry]”;

1 Like

HAHA. Thanks. Removing the “repeat through the table” line gives me what I want, and now I better understand what “repeat through” does.


1 Like

Oh sorry, yeah, I did that too and then forgot to mention it :slight_smile:

1 Like

No, it’s better that I see for myself what happens when I set something up incorrectly and ID the problem myself if I can (super proud for tweaking right away to what had happened there). This is how I learn best.


This compiles in both 9.3/6M62 and 10.1. I think you may have had tabs wrong or something. (Yay syntactically significant characters visually indistinct from spaces!)

lab is room.

Table 2 - Selected Elements
Element	Symbol	Atomic Number	Atomic weight
"Hydrogen"	"H"		1				a number
"Iron"		"Fe"	26				--

I’ll add that I don’t like this form of table specification and never use it. This works fine, too:

Table 2 - Selected Elements
Element	Symbol	Atomic Number	Atomic weight (number)
"Hydrogen"	"H"		1				--
"Iron"		"Fe"	26				--

Stay tuned for my forthcoming book How Inform Really Works: the stuff I won’t tell you for free at just $99.99.


Yeah, that compiles – the issue comes in when you try to use the table to define a kind. Like, this borks in 9.3:

Test is a room.  A LockName is a kind of thing. Some LockNames are defined by the table of choiceorder.

Table of ChoiceOrder
LockName	Bookdesc	Memory	ObjectDesc	 OrderNumber 
lock A	"some textA"	"[memoryA]"	"keyhole A." 	a number	
lock B	"some textB"	"[memoryB]"	"keyhole B"	--
lock C	"some textC"	"[memoryC]"	"keyhole C"	--
lock D	"some textD"	"[memoryD]"	"keyhole D"	--
lock E	"some textE"	"[memoryE]"	"keyhole E"	--
lock F	"some textF"	"[memoryF]"	"Keyhole F"	--

(I didn’t check in 10.1 since I know Amanda’s not working in that yet).

EDIT: the second syntax you just edited in is indeed the one that works! But it doesn’t appear to be in the relevant bit of the docs.

1 Like

Yeah, defining objects by table has some major issues and is probably better avoided. (And defining kinds by table doesn’t work at all in 10.1.)


that said, this works (in 9.3/6M62 and 10.1). Oh, I see you already said that, Mike.

lab is room.

a lockname is a kind of thing. some locknames are defined by the table of ChoiceOrder.

Table of ChoiceOrder
LockName	Bookdesc	Memory	    ObjectDesc	 OrderNumber (a number)
lock A	"some textA"	""	"keyhole A" 	--	
lock B	"some textB"	""	"keyhole B"		--
lock C	"some textC"	""	"keyhole C"		--
lock D	"some textD"	""	"keyhole D"		--
lock E	"some textE"	""	"keyhole E"		--
lock F	"some textF"	""	"Keyhole F"		--

when play begins:
  repeat with ln running through the locknames begin;
    say "[ln] [ordernumber of ln].";
  end repeat;

Weird. No, I didn’t change the table at all except for removing the “a number” from the top of the column and sticking onto the end of ordernumber. Inform does not like me.

I have a working system! It’s not pretty, but it works, and it didn’t require a lot of nested ifs. Whew.


Is this what you want?

To look up (N - a number):
    choose the row with ordernumber N in the Table of ChoiceOrder;
    say "[LockName entry] [Bookdesc entry] etc"

I assume you’ll never have two rows with the same ordernumber?

1 Like

I got it, thanks! It’s ugly, but it’s mine.

No-- once a player does something, it’s fixed in the order they did it. Which was like the only good design choice I made here.


It’s super generous to even mention me in the same company as @Zed when it comes to Inform; I promise you I am nowhere remotely near as qualified as Zed. The more I learn the more I become aware of how much I don’t know. Dunning-Kruger effect for sure. With that said, I’d love to help however I could. I had already been contemplating an “Inform for Well-Meaning Idiots by another Well-Meaning Idiot” (Working Title) YouTube series for some time, as I feel like that’s where my confidence level is with that, but maybe that’s from spending too much time reading posts by Zed and Zarf.