Continuing a table only after certain conditions are met


#1

Hi there! I have a table I’m using for a hint system, based on the “Ish.” example here: http://inform7.com/learn/man/RB_11_3.html. I would like to extend the hints with a continued table, but only after particular conditions are met. For example, once you’ve reached a certain stage of the game, you’ll have examined a particular object. After that, I can hint about that object without it giving away any spoilers.

I understand how to make a continued table. My question is, how do I only use the continued table after that object has been examined? Thanks for any pointers or suggestions! :sunglasses:


(matt w) #2

I don’t think there’s any particular hook for saying “only use the continued part of the table as such if this condition is fulfilled”–I believe that the internal representation of a table-with-continuation is no different than if the table had all been put in the source code in one place. (I mean, I don’t have any real reason for believing that, I certainly haven’t looked at the internals, I just haven’t seen anything that would tell me otherwise.)

One thing you could do is include another column for “unlock object” or something like that, and then you could include a condition that checks whether the unlock object has been examined before printing anything. You could do that by testing whether there is an unlock object entry in the chosen row, and whether “we have examined” the unlock object entry. Here’s a way to do this in “Ish,” hiding the microdot help until the player has examined the microdot (which we implement as a carried thing):

"Ish."

Ichiro's Dubious Sushi Hut is a room.  "Despite the allure of the dusty plastic sushi models in the window, you're beginning to have second thoughts about the selection of this particular restaurant for your rendezvous with Agent Fowler.  There are no other patrons, for one thing. Afternoon sunlight filters lazily through the window and illuminates a number of empty glass-topped tables, at each of which is a chopstick dispenser (in form of cute ceramic cat) and a pitcher of soy sauce (sticky).

The sushi bar itself is what gives the most pause, however. Behind it sits an angry-looking Japanese woman, aggressively eating a Quarter Pounder with Cheese."

The player carries a microdot. The description of the microdot is "This is what you came to deliver."

[We can, when necessary, accept any text at all as a token:]

Understand "help [text]" or "help about [text]" as getting help about. Understand the commands "instructions" or "hint" or "hints" or "menu" or "info" or "about" as "help".

Getting help about is an action applying to one topic.

[After that, we can use "the topic understood" to refer to the text we read:]

Carry out getting help about:
	if the topic understood is a topic listed in the Table of Standard Help and (there is no unlock object entry or we have examined the unlock object entry):
		say "[explanation entry][paragraph break]";
	otherwise:
		say "You're out of ideas."

Table of Standard Help
topic	title	summary	explanation	unlock object
"sushi"	"sushi"	"Really it's just vinegary rice"	"Popular misconception says that sushi inevitably entails raw fish, but it is in fact just rice with rice vinegar on it.  It's just that the really good kinds have raw fish in."	--
"cucumber roll" or "cucumber"	"Cucumber roll"	"Sushi for people who are afraid of sushi"	"It is just rice and slivers of cucumber in the middle, and as long as you don't go too crazy with the wasabi, all should be well."	--
"california roll" or "california"	"California roll"	"Travesty of the sushi concept"	"It's. Fake. Crab."	--
"monkfish liver"	"monkfish liver"	"Expert eaters only"	"The odds of Ichiro's having this unusual delicacy is near zero."	--
"microdot"	"microdot"	"What you came here to deliver"	"There'll be time enough for that later. If Fowler ever turns up. Where is she, anyway?"	microdot

[Since the player may not know what all the help options are, we might as well let him get an overview, as well.]

Understand "help" as summoning help.  Summoning help is an action applying to nothing.

Carry out summoning help:
	say "Help is available about the following topics.  Typing HELP followed by the name of a topic will give further information.[paragraph break]";
	repeat through the Table of Standard Help:
		unless there is an unlock object entry and we have not examined the unlock object entry:
			say "  [title entry]: [summary entry][line break]".

Test me with "help / help about microdot / help cucumber / help california roll/ x microdot/ help/ help about microdot".

ETA: Ugh, the table looks awful there, but if you hit the “copy code” button in the upper right corner and paste it into the IDE it should… well, tables usually look awful in the IDE too. But the tabs are lined up properly, I promise.


#3

The manual for table continuations (http://inform7.com/learn/man/WI_16_18.html) says “The continuation has no existence in its own right: Inform simply splices the two (or more) pieces together, exactly as if the table were all in one piece at the place where it first occurred” so some kind of workaround like Matt describes is definitely needed.

Another possibility would be to vary which table you look at (http://inform7.com/learn/man/WI_16_15.html). This may not be useful for you as you then lose the ability to refer to the entries from the first table, but I mention it for the sake of completeness.


#4

Oh, clever, that makes sense. And that will make it easy to keep unlocking more levels of hints. I’ll try it! Thanks.