Day 14, 15 & 16: Writing Widgets and World Building

Day 14, 15 & 16: Writing Widgets and World Building

Welcome back to writing an IF story in 30 days! We’re halfway through and our goal now is to write as much as possible. At least 1,000 words a day. Today I’ll be reviewing some more code necessary to make a story that reads well with variable genders and love interests: WIDGETS.

The widget is like the secret weapon of interactive fiction. Once you understand how to use it, you will see how you can crank out an IF story as easy as a normal story. We’ll also discuss world-building which is what your additional lineages are for.

Once again, this is all in my humble opinion. Let’s begin.

After setting up our introduction to allow the writer to choose from different genres, we need a way to control these various answers. For that we create something called a widget. This always takes me a bit to set up, so be patient in this part of the process, because it’s where a good portion of your coding will take place. Also, remember to set up a spreadsheet where you keep all your variables. (I’ll attach mine so you can see how I set it up.)

Now then, the widget, in plain English, says something like: “If the user chose this gender, show this, when I type this.” To be more exact, my widget allows you to write “Him” but it will show either “Him” or “Her” or “It” or “Whatever” depending on what you choose and what the player chose. Here’s the basic “pronoun” widget code:

cyoa widget for twine interactive fiction stories

Let’s break down each part of the code. The word ‘widget’ opens the widget then in quotes we put the widget we will call. I suggest making it something along the lines of **loverShe** or **lovershe**. This makes it easy when writing the dialogue to just substitute lovershe for she and loverShe for She. Note also that gender matters, so when you set the variable if you put widget loverHe and then later in your writing call (meaning type out) loverShe it will not work. The logic looks to see which $genderlover was set by the user and figures the correct variable to put into the story, so be consistent. Next, if $genderlover eq (means equal) “male”. Then the word He, in between the less than and greater than signs is the exact text that will be displayed if the statement is true. This means that in the passage where the user chose their preference, you need to put the variable declaration:

interactive fiction cyoa gender spouse preference setting

Confused? Here, let me show how to use this widget in a passage so it makes sense.

interactive fiction tutorial writing with Twine app

That’s it! I set up my widget passage with dozens of options from King/Queen to husband/wife and even himself/herself. We’ll even use a variant for more robust situations in the near future.

A final note, I’m about 2700 words in right now, and I’m focusing on each “cluster” of choices as a way to do some world-building for my larger DJ Santa concept. I suggest this for all of my writers, use these branches of story-line for world-building. It’s one of the unique aspects of an interactive fiction story. As readers get to branches that don’t get to full endings, they get a small jewel of wisdom that helps explain more of the plot. If they never see these aspects of the plot, that’s okay too, but it adds a certain layer of depth.

So far, “Mrs. Claus” is not very happy with Santa but you will only know that if you chase after her/him. Also, going down that branch allows you to get the ancient Santa instruction manual which has the instruction on using your magical sleigh. Also, there are few different ways to perish. I’ve decided that what makes Santa cease to be is if the prayers and hopes of the world’s children turn against Jolly Ole St. Nick! He just kinda melts away because he’s lost the “Christmas Spirit”. I’m using the "#died tag and a red color to tag those passages but we will get to that later. Now onto the “Lead Elf” and the Ancient Society of Santas!

Use your branches for world building!

It’s been really fun to write and I can’t wait for you all to read it.

Write on folks!

Day 17, 18 & 19: Cluster Writing, Tags and Choice Variance

Day 17, 18 & 19: Cluster Writing, Tags and Choice Variance

DAY 13: CODE FOR THE FUTURE

DAY 13: CODE FOR THE FUTURE