Error finding

Hi, all!

I gain a small amount of encouragement knowing that I have to come back to these boards less and less as time grows.

Anyway, can’t understand why the following doesn’t work.

I have a scenario in which the player can sell something to a vendor. I am able to sell an item, and the value of the sale records properly in the corresponding table. However, the name of the item does not.

			
selling is an action applying to one thing.  understand "sell [something]" as selling.


check selling something:
	if sell value of noun is 0:
		say "The pawn broker takes a look at the [noun] and then shakes her head.  The eerie smile returns.";
	otherwise:
		continue the action.
		
carry out selling:
	increase bucks by sell value of the noun;
	now noun is in glass case;
	choose a blank row in Table of Sold Items;
	now name entry is "[noun]";
	now sold value entry is sell value of noun.
	
report selling:
	say "The pawn broker takes your ID and swipes it through something on the other side of the case.  She resumes her smile and hands the ID card back to you, then places the [noun] in the display case.  '[bucks] dollars to you, sir,' she says and again the blank, eerie smile."

The corresponding tables read as such:


Table of Pawned Items
Name (text)	Pawned value (a number)
with 23 blank rows

Table of Sold Items
Name (text)	Sold value (a number)
with 23 blank rows

The player is able to keep track of what he has sold by reading the whiteboard on the wall:



instead of reading when noun is whiteboard:
	if the number of filled rows in Table of Pawned Items is 0:
		say "Pawned items:[paragraph break]";
	otherwise:
		say "Pawned Items:[line break]";
		repeat through the Table of Pawned Items:
			say "[name entry] -->  $[pawned value entry][paragraph break]";
	if the number of filled rows in Table of Sold Items is 0:
		say "Sold Items:[paragraph break]" instead;
	otherwise:
		say "Sold Items:[line break]";
		repeat through the Table of Sold Items:
			say "[name entry]  -->   $[sold value entry]"

Now, if I sell the ‘Jade Statuette’ and read the whiteboard, the value is recorded correctly but the name is not:

sell statuette
The pawn broker takes your ID and swipes it through something on the other side of the case. She resumes her smile and hands the ID card back to you, then places the Jade statuette in the display case. “30 dollars to you, sir,” she says and again the blank, eerie smile.

read whiteboard:
Pawned items:

Sold Items:
whiteboard – > $30

Should say, ‘Jade statuette → $30’

Anyway, the solution is probably something simple but I can’t see it.

One more thing to add: the proper item does make it into the glass case. So it does understand what the item is.

Thanks!

The problem is that noun is not evaluated in your carry out selling rule at the time that you place “[noun]” in the name entry of the table. The rule for generating the text is stored as-is in the table and evaluated later when the player is reading the whiteboard, because it’s only then that it needs to be printed. At that time, noun is the whiteboard, so the name of the whiteboard is printed. To solve the problem, you need to evaluate the name of the noun at the time when the player is selling and store the resulting text in the table.

In your carry out selling rule, replace

	now name entry is "[noun]";

with

	now name entry is the printed name of the noun;

Wow! Thank you!

Alternately,

now the name entry is the substituted form of "[noun]"

will help if you have objects with complicated “rules for printing the name of…”