Epistemology / last familiar noun

Not sure if this is possible, but using the Epistemology extension’s special adjectives, I’d like to print text for the last noun marked as “familiar”. Example code below (working but for my made up [the HenryThought of the last examined familiar noun] segment of code).

Include Epistemology by Eric Eve.

A thing usually has a text called HenryThought.

The Library is a room. The Office is south of the Library. Henry is a person in the office. Henry can be talkative or quiet. Henry is talkative.

Every turn when Henry is talkative:
	if Henry is not in the location of the player:
		let the heading be the best route from the location of Henry to the location of the player;
		try Henry going the heading.
		say "[the HenryThought of the last examined familiar noun]" [<-- How do I make this real working code?]		

The description of the Library is "A room full of books.".

The Library_Shelf is a fixed in place supporter in Library. Understand "bookshelf" as Library_Shelf. The printed name of Library_Shelf is "bookshelf". The description of Library_Shelf is "A shelf full of books." The HenryThought of the Library_Shelf is "I have an overdue book at home.". 

Carry out examining the Library_Shelf: now the Library_Shelf is familiar.

The Library_Counter is a fixed in place supporter in Library. Understand "counter" as Library_Counter. The printed name of Library_Counter is "counter". The description of Library_Counter is "The check-out counter." The HenryThought of the Library_Counter is "I need to sign up for a library card.".

Carry out examining the Library_Counter: now the Library_Counter is familiar.

The description of the Office is "A drab office."

The Office_Trash is a fixed in place container in Office. Understand "trashcan" as Office_Trash. The printed name of Office_Trash is "trashcan". The description of Office_Trash is "A small trashcan." The HenryThought of the Office_Trash is "The janitor just cleaned out the trash can".

Carry out examining the Office_Trash: now the Office_Trash is familiar.

The Office_Desk is a fixed in place supporter in Office. Understand "desk" as Office_Desk. The printed name of Office_Desk is "desk". The description of Office_Desk is "A dented metal desk sits in the center of the room." The HenryThought of the Office_Desk is "I have so much work to do and I don't want to do any of it today."

Carry out examining the Office_Desk: now the Office_Desk is familiar.

On the Office_Desk is the Office_RubiksCube. Understand "cube" and "rubiks" and "rubik's" and "rubik's cube" as Office_RubiksCube. The printed name of Office_RubiksCube is "Rubik's Cube". The description of Office_RubiksCube is "A colorful cube-shaped puzzle.". The HenryThought of the Office_RubiksCube is "I can never figure that puzzle out."

Carry out examining the Office_RubiksCube: now the Office_RubiksCube is familiar.

Instead of giving the Office_RubiksCube to Henry:
	say "You give Henry the Rubik's Cube and he immediately declares, 'I'm going to solve it this time!'";
	now Henry has Office_RubiksCube;
	now Henry is quiet.







Hi!

First of all, you don’t need these:

Carry out examining the Library_Shelf: now the Library_Shelf is familiar.

… etc. because the familiar flag is automatically set when the object is examined. See the extension docs:

This extension also marks an object as both seen and familiar when it is examined (which should catch most, if not all, the cases not already covered).

But to do what you want, you can just set a global variable every time you examine something:

The last examined thing is an object that varies.

Last carry out examining:
	now the last examined thing is the noun.

Every turn when Henry is talkative:
	if Henry is not in the location of the player:
		let the heading be the best route from the location of Henry to the location of the player;
		try Henry going the heading;
		say "[the HenryThought of the last examined thing].".	

Also, I’m not sure why you are naming your objects using underscores, but don’t do that. If you’re worried about disambiguation issues, there are better ways of dealing with that. Naming objects as you have only bypasses the built-in methods the parser uses to recognize objects. Try “x shelf / x can / x trash can / x library counter”, etc. to see what I mean.

HTH.

ETA: PS - Thank you for including a complete code example! It made figuring out what you wanted so much easier. :slightly_smiling_face:

Awesome, thanks! Much simpler solution than I was expecting.

Re: my naming conventions. How I was taught. The actual game I’m working on is humongous so while it’s likely unnecessary, it keeps me sane. The example I provided doesn’t show it, but I write out a ton of “understand as” bits to avoid disambiguation issues. We shall see!

Hey, that’s how I write I7.

(Except I use hyphens instead of underscores.)

1 Like