Blank table rows

I’m trying out tables for the first time and running into a lack of understanding and/or missing some important lesson from the manual. With the below (obviously a excerpted section of my code), I’m getting an error of:

“*** Run-time problem P23: Attempt to look up a non-existent entry at column 1, row 10 of the table ‘Table of Game Verbs’.”

Where am I going wrong?

Table of Game Verbs
Action	Character
"Examine"	0
"Look"	0
"Take"	0
"Ask about"	0
"Drink"	0
"Use"	0
"Fill"	0
"Give"	0
with 10 blank rows

[this is part of a 'room' where the player can select a character]
To say PlayerChange:
	Wait for any key;
	Now the player is Simon;
	choose a blank row in Table of Game Verbs; 
	now Action entry is "Fire"; 
	now Character entry is 2.

When I try this as a standalone code sample, it works correctly.

Try showme the contents of Table of Game Verbs; as a debugging line of code, to see if the table is being set up the way you expect.

2 Likes

Apologies, I realize now that I was associating the issue with the adding of rows to the table, not realizing that it’s during the listing the of table that the error occurs:

Listing the verbs is an action applying to nothing.
Understand “verbs” or “list verbs” as listing the verbs.
		
Carry out listing the verbs:
	say “The following verbs are available to you:[line break]”;
	repeat with N running from 1 to the number of rows in the Table of Game Verbs: 
		say “[line break][Action in row N of the Table of Game Verbs]”.

Have to assume that it’s getting cranky about those empty rows. How do you get it to ignore empty rows while listing?

Maybe try

	repeat with N running from 1 to the number of rows in the Table of Game Verbs: 
		if there is an Action in row N of the Table of Game Verbs:
			say “[line break][Action in row N of the Table of Game Verbs]”.

“Repeat through” skips empty rows.

Carry out listing the verbs:
	say "The following verbs are available to you:[line break]";
	repeat through the Table of Game Verbs:
		say "[line break][Action entry]".
2 Likes

Thank you, all.