The title basically sums up my question. I want to print a list of things in a way similar to “[list of things carried by the player]” but with “or” as the conjunction instead of “and”. I can’t find anything in the documentation or phrasebook about this.
One way to do that would be to use the built-in extension “Complex Listing” by Emily Short.
You include the extension in your project (“Include Complex Listing by Emily Short.”), “prepare” the list you want to display (e.g., “prepare a list of things carried by the player”), and print it using the “disjunctive” style (say “[the prepared list delimited in disjunctive style]”).
I thought about an example and got a bit carried away, so here’s a brief complete scenario, just for fun:
[code]Include Complex Listing by Emily Short.
When play begins, say “You have been chosen to appease the irascible Volcano God. You climbed all the way to the edge of the crater, now you may sacrifice one thing, and one thing only!”
Near the Edge of the Volcano is a room. “Incredible heat rises from the lava below.”
The player carries a watermelon, a plush iguana, and a replica of the Venus of Willendorf.
Instead of taking inventory:
prepare a list of things carried by the player;
say “What will you sacrifice to the Volcano God: [the prepared list delimited in disjunctive style]?”.
Instead of dropping something:
if the noun is the watermelon:
say “The melon vanishes with a barely audible splash and a hiss. Nothing happens. Then a deep voice growls, ‘Surely you jest!’ Hmmm, it seems the Volcano God is not too pleased. You decide to run back to the village to tell everyone to flee.”;
end the story saying “It occurs to you that you’ll have nothing to eat on the way back home.”;
otherwise if the noun is the replica:
say “The replica drops into the lava, which bubbles up in turmoil. A deep voice thunders, ‘This voluptuous goddess was my lover once! How dare you steal and sacrifice her idol?’ A red-hot chunk of molten rock flies up and hits you.”;
end the story saying “You have died a fiery death.”;
otherwise if the noun is the iguana:
say “The stuffed effigy of the Iguana God goes up in flames. A deep voice rumbles: ‘You have chosen well. Your village will be spared from my wrath for the next millennium.’”;
end the story finally saying “You have placated the Volcano God.”.[/code]
You don’t actually need to prepare the list this way. It can print any list you’ve already got. The preparing a list stuff is because ‘say “[list of things carried by the player in disjunctive style]”.’ does not compile. ‘Prepare a list of…’ just sets the global ‘the prepared list’ so you can avoid declaring a temporary.
Thanks for the help! Believe me, I get carried away in examples too.
Hold on, how do you make it print any list you’ve got (e.g. a list of table entries)? I don’t quite understand how to do that from this post.
Assuming the list already exists; ‘[the list in disjunctive style]’. If it doesn’t already exist… well, ‘prepare a list…’ is some handy shorthand for declaring temporary variables.
That doesn’t appear to successfully compile (neither does “[the list delimited in disjunctive style]”). I can only seem to get that disjunctive style on prepared lists, but I’m having trouble using prepared lists for all my required uses of it (probably should have mentioned in the beginning that it isn’t just things I want to do).
One use is for a topic suggester, like “You could talk to X about A, B, or C”, where A, B, and C are texts in a table in which the corresponding row to the text has an “1” as an “enabled” entry (I’m aware there are extensions that already do this, but I’m trying to make my own topic suggester for myself). I can’t seem to work out how on earth to do that with “prepare a list…”.
Basically, how could you do “prepare a list of topic name entries in Table A whose corresponding rows have an enabled entry of 1.”
Sorry for all the difficulties!
I think that the extension is geared towards lists of things, judging from a quick look at its source code. So here’s one way of doing it with things from a table:
[code]Include Complex Listing by Emily Short.
The Imperial Palace Gardens is a room. “The Gardens are as beautiful as always, but today, your mind is on Eleonora.”
Eleonora is a woman in the Palace Gardens. “There she stands, lost in thought. Maybe you can amuse her with a song.” The description is “The flowers pale in comparison to her.”
A subject is a kind of thing.
The spring weather is a subject. The glory of the Empire is a subject. The insurgency is a subject. The scandalous affair of Archibald de Winter is a subject.
Table of Eleonora’s Subjects
Instead of singing:
repeat through the Table of Eleonora’s Subjects:
if enabled entry is 1:
now the Subject entry is marked for special listing;
register things marked for listing;
say “You could sing about [the prepared list delimited in disjunctive style].”[/code]
(Obviously, I didn’t bother to implement any actual “singing/talking about” action, because I only wanted to show a quick way of combining a table approach and Complex Listing. The details will depend on your conversation system anyway, of course.)
You could also take a look at Example No. 271, “Sweeney”, from chapter 15.16 in the manual (or chapter 7.8 in the Recipe Book). It uses a table for the conversation contents and lists options using “or” (without including Complex Listing).