Conditional text and table values

I have a complicated, messy area with lots of nouns that may or may not be present. It seemed like something that could be managed with a table, and I seem to have figured that out. This part is straight out of the manual:

statuary is a kind of scenery backdrop. the plural of statuary is statuaries. Some statuaries are defined by the table of distant sculpture.

Table design is not very ambitious, either

table of distant sculpture
statuary	destination	disposition	verbiage
David	SB	intact	"a text"

However, I am having trouble doing some conditional stuff. I can stick something like this in a text:

[if the disposition corresponding to a statuary of guardian head in the table of distant sculpture is intact]

And that works, but it’s a lot. To type, yeah, but also a lot of chances to flub up some typos. Maybe I’d like to define an adjective based on whether not a noun defined in the table has a value of intact. Then the text could me managed more easily:

“[if david is intact]David is looking good.[otherwise]I wonder what happened to David.”

I’ve messed around with definitions, but I’m not getting it right. My problem is that I don’t know how to
refer to the thing being evaluated (which is a noun defined in a table).

Definition: a statuary is intact if the disposition corresponding to [?]

to decide if a statuary is intact:

I can do this in action processing, of course, because I have a “noun” to work with. Maybe I should just be keeping some values outside of the table. I like the idea of having everything there…

I could add another “before doing something” rule and update everything each turn, but I feel like I shouldn’t pile those on. Advice?

You can use the “(called ...)” syntax to introduce a variable name in order to refer back to it in the course of the definition:

Definition: a statuary (called S) is okay if the disposition corresponding to a statuary of S in the table of distant sculpture is intact.

(Side note: I used “okay” instead of “intact” for the definition here because the term “intact” can confuse Inform with regard to the disposition “intact” in the table; depending on how that’s defined.)

With the definition above, you can then use the desired abbreviations, as in:

say "[if David is okay]David is looking good[otherwise]I wonder what happened to David[end if].";

Edited to add:
Although, since the table defines the properties of the statuary objects, you can also just refer to the properties directly:

say "[if the disposition of David is intact]David is looking good[otherwise]I wonder what happened to David[end if].";
1 Like

Ah, thanks. That’ll clean up my code considerably!

1 Like

If you’re defining things by table, you don’t have to concern yourself after the fact with the table’s existence. They’re real things as if you’d defined each personally. So if X is a statuary, if the disposition of X is intact does what it sounds like.

An anonymous property would be more convenient here, since those values become adjectives automatically and you could use just if X is intact. But you can’t populate the values of anonymous properties when defining by tables.

3 Likes