"Column 2 (result) of 'Table of Cooking' contains no values and doesn't tell me anything about its kind."

I am so afraid this is the silliest mistake ever, but I genuinely can’t figure out what is wrong.

I am trying to implement a cooking system for my game. Luckily, I found the following post. Trying to make a cooking system? - #4 by matt_weiner

I want my game to have a decent amount of recipes, so I decided to follow matt w’s example of using a table to store the recipes so I can easily add recipes to the game.

I’ll add my version of the code.

[code]Some mashed potatoes with steak is a thing.

A power switch is a device. It is part of the oven.

Table of Cooking
ingredients	result	report
{steak, mysterious milk, lonely potato}	mashed potatoes with steak	“The steak still oozes with juices even after being cooked, making the mashed potatoes look dry in comparison.”

To decide whether (listone - list of values) is identical to (listtwo - list of values):
	repeat with item running through listone:
		if item is not listed in listtwo, no;
		repeat with item running through listtwo:
			if item is not listed in listone, no;
			yes.
	
Instead of switching on the power switch:
	let L be the list of things in the oven;
	repeat through the Table of Cooking:
		if L is identical to the ingredients entry:
			now everything in the oven is nowhere;
			now the result entry is in the oven;
			say the report entry;
			say line break;
			rule succeeds; [this ends the whole rule]
			say "You won't get anything by cooking  [if the number of entries in L is less than 3]just [end if][L].”[/code]

(The three food items and the oven are a bit farther down in the section of the code describing the kitchen, with a fridge and the oven this code references inside that location.)
I tried my very best to copy matt’s code identically but maybe I made a very stupid typo. Whatever it is, when I try to run this code, I get the following error.

Problem: In 'Table of Cooking', I'm reading the text 'mashed potatoes with steak' in column 2 (result) of row 1, but I don't know what this means.

This should usually be a value, like a number or a piece of text, or a blank entry marker '--', but in some circumstances it can also be an action (such as 'taking the box'), or a kind (such as 'a number') to show what sort of values will go into an otherwise blank row.

Problem: Column 2 (result) of 'Table of Cooking' contains no values and doesn't tell me anything about its kind.

Anyways, I don’t understand why it can’t recognize that the mashed potatoes and steak are in column 2 of the table. What’s going wrong here? The mashed potatoes and steak are a thing that exist. Did I go wrong somewhere making the table? Like with the indenting? This one is stumping me.

The declaration in your code for the mashed potatoes with steak object will not compile on its own, so this seems to be the root problem. Since that’s not accepted as a valid declaration, the compiler can’t interpret the meaning of the words “mashed potatoes with steak” in the table (causing the first problem message) and as a result can’t figure out the kind (i.e. data type) of the second column (causing the second problem message).

Certain words (such as “with”) can have a different meaning in object declarations and so are best avoided. You can name an object one thing internally while still presenting it to the player as something else, such as:

A steak-and-potato meal is a thing. The printed name of the steak-and-potato meal is "mashed potatoes with steak". Understand "mashed/-- potato/potatoes" or "with/-- steak" as the steak-and-potato meal.

Here’s some slightly reconfigured example code that seems to do what you intend:

A steak-and-potato meal is a thing.

Some steak, some mysterious milk, and a lonely potato are things.

A power switch is a device. It is part of the oven. The oven is a container.

Table of Cooking
ingredients	result	report
{steak, mysterious milk, lonely potato}	steak-and-potato meal	“The steak still oozes with juices even after being cooked, making the mashed potatoes look dry in comparison.”

To decide whether (listone - list of values) is identical to (listtwo - list of values):
	repeat with item running through listone:
		if item is not listed in listtwo, no;
	repeat with item running through listtwo:
		if item is not listed in listone, no;
	yes.
	
Instead of switching on the power switch:
	let L be the list of things in the oven;
	repeat through the Table of Cooking:
		if L is identical to the ingredients entry:
			now everything in the oven is nowhere;
			now the result entry is in the oven;
			say the report entry;
			say line break;
			rule succeeds; [this ends the whole rule]
			say "You won't get anything by cooking  [if the number of entries in L is less than 3]just [end if][L].”

Note that I adjusted the to decide whether... phrase’s indenting because it didn’t seem like you really would want everything to be contained in the first repeat loop. I also added some declarations (for the ingredients and the oven) to get it to compile that you’ll want to remove.

5 Likes

Oh my goodness, it really was a silly problem. Thank you so so much!

1 Like

This is the turn of phrase needed to create ‘some mashed potatoes with steak’ as intended:

A thing called some mashed potatoes with steak is in the Lab.

see this post

1 Like