Multiple Choice (Twine-Like System)

It’s been a long time since I’ve touched ZIL, but from my tinkering over the years it’s my favorite language for making IF. I was wondering if there are any implementations of multiple-choice selections like you would see in Twine for ZIL.


Your brother always believed life was out there in the universe. You...
1. Hoped that we would meet them, someday.
2. Were indifferent.
3. Thought it was a waste of time.

I think having an extension for this kind of functionality would be pretty handy, especially if somebody wants to have a little bit of character creation. Are there any existing implementations or ways I can do something like this?


See @daelsepara’s work: Some gamebook adaptations in ZIL


There’s Hybrid Choices—it’s specifically geared towards gameplay that mimics a print CYOA, complete with page numbers, but I know people have used it to do menu-based conversation, which seems like a similar application to what you’re looking for.

Edit: Never mind, this is an Inform 7/10 thing and I was being an idiot.


Hybrid Choices is great, but I don’t think anyone’s made a ZIL version of it yet.

1 Like

Whoops, sorry, I can’t read apparently.

1 Like

No existing methods, but you could use <SET X <INPUT 1>> inside a REPEAT loop, and then in the function you use (if the choices are letter, and the letter we’re looking for is an A):


I managed to make a basic implementation of this by modifying V-LOOK, and creating a new property called CHOICES. Here’s a basic example of it’s usage.

    (IN ROOMS)
    (LDESC "This is outside of your house.")
        1 "Go back inside." TO LIVING-ROOM)>

    (IN ROOMS)
    (LDESC "This is the living room.")
        1 "Go outside." GO TO OUTSIDE
        2 "Go back into your room." GO TO BEDROOM)>

    (IN ROOMS)
    (LDESC "This is your bedroom.")
        1 "Go to living room." TURN TO LIVING-ROOM)>

Effectively the user cannot write out parser commands in any room with the CHOICES property used. This way you can use each room similarly to a node in Twine, or something similar. It’s pretty basic but I think I may try to post it on github as a ZILF package, since I can’t be the only person who’d want this.

EDIT: Here’s the link to my GitHub repository with the package. Feel free to let me know if there are any issues.


Having appreciated the very same mechanism in the two Pathfinder CRPG, I can fully appreciate the usefulness of this “choice rooms” mechanism.

Best regards from Italy,
dott. Piergiorgio.

1 Like

I’ve adopted a similar approach where pages or story sections are defined as ROOMs in ZIL. Some story sections ask you to make a choice or continue to another section. I’ve added them as CHOICES/DESTINATIONS/TYPES and CONTINUE properties in a room.

CHOICES, DESTINATIONS, TYPES are tables containing texts (of the choices), and ROOM destinations, and the choices’ required conditions respectively. CONTINUE would also point to a choice ROOM. The whole gameplay loop mainly consists of printing the room description (section text), checking player and room events and conditions, displaying choices (if there are any), and finally waiting for user input.

Here’s a repo of my take on choice-based ZIL.

Of interest, I think is the story.zil and gamebook.zil, which contains stuff specific to a gamebook and the engine which I can re-use in other gamebooks I implemented. I’ve also extracted some useful, minimum stuff from Zilf’s libraries (minilib.zil)

Sample code from story.zil:

<CONSTANT TEXT001 "The road tops a ridge that is straddled by the ruins of a great wall, half covered in turf. The wall once marked the border between the lands of man and domain of the elves. Quickly you scramble up and over the blocks of fallen stone. Standing atop the ruin, you survey the outlands beyond.||Your gaze sweeps across the broad patches of purple heather and yellow gorse that cover the inhospitable uplands. The air smells fresh; it is good to be free of the noisome taint of the sewers and plague pits of the city you have left behind. The road winds down into a valley, at the foot of which nestles Burg, a small town of neat white houses with roof of triangular grey slates. Here may be your last chance to talk with mankind before you are swallowed up by the depths of the great Forest of Arden.||As you walk towards the buildings through the tilled and reaped land of the valley, you pass gleaners -- peasants who search the ground for stalks of straw and seed spilled during the harvest. The townsfolk, seemingly wary of outsiders, keep out of your way. Ahead of you is an inn, the largest building in the town. Looking forward to perhaps your last night's sleep in a proper bed for many weeks, you make for this hostelry.||The inn seems surprisingly large for a town that is at the very edge of the wilderness. It must once have been a baronial hall built by a lord seeking to carve out a kingdom beyond the great wall. As you walk down the main street the ruddy sky is turning violet with the onset of twilight. What looked an inviting little town by day seems sombre and unwelcoming at nightfall. As you linger a moment outside the inn, there is a crack of thunder and it begins to pour with rain.||Inside the inn a young girl is lighting oil lamps with a taper. Until your eyes grow accustomed to the gloom you cannot make out who shares the common room with you, nor many details of the interior of the inn itself.">
<CONSTANT CHOICES001 <LTABLE "wait by the door until you can see better" "step in and warm yourself before the fire">>

	(DESC "001")

<CONSTANT TEXT002 "\"It is the forest which cleans and purifies the air for all the world to breathe. Without the Forest of Arden all living things would choke, gag, and die. The trees absorb the foul air of man's pollution, his burning and wasting, and give it back to the world again clean, fresh and ready to breath. The stench and dross of the cities is purged and cleansed by the trees. The forest is the lifeblood of the world.\"||The old woman delivers these words very gravely, convincing you that she believes every word of what she is saying. All the time her eyes never leave yours.||\"Ah, but I see I bore you. Enough of this idle prattle, I must take my rest. Good night to you.\"||So saying, she gets up and makes to leave you. You are about to protest that you are far from bored but realize she is only looking for a polite way to leave your company. You let her go and decide to take a room at the inn as well.">

	(DESC "002")

<CONSTANT TEXT003 "A figure lies dead in the forest. Ants crawl in and out of its newly picked-clean eye sockets; beetles and rats gnaw at the remains. With a shock you realize the figure is wearing identical clothes to yours -- there isn't another pair of boots in the world quite like yours, made to order by a cobbler in Godorno.||\"You are not wearing my ring,\" says Elanor. \"If you cannot trust me, I cannot aid you. You must find your own way and I must continue my search for the saviour of the forest. Begone and never come back, you weak-willed doubter.\"||Elanor and the owl disappear. You are on your own again.">


That said, even when considering the constraints of the Z-Machine, ZIL is a very capable language.


Awesome! The next thing to try (in z5 probably will work, else z6) is use clickable buttons as well as numbers, like in the opening screen of Shogun.

1 Like