Coding

All things computer programming related...

Using Rez on Windows

- Posted in Coding by

I was able, using the instructions found here to get Rez working on my Windows machine. The creator of Rez has been very encouraging, and I'm thinking about devoting some considerable time and effort to learn to use this tool.

Future Twine Titles

- Posted in Coding by
Adrift Until A Tad Bit Informed
Ancient Writings, Strange Births
At My Feet In Ashes Lay
Better Than Nothing
Fantabulous
Far Gone The Time
Good, Wise, And Perfect Reasons
I Write In Twine Now
I'll Leave It All To Chance
My Undiminished Foe
Night Inevitable
No Courage Dries My Tears
Nothing Broken In Heaven
Ocean Beyond All Others
Only In Extremis
Practicing the Pause
Redrum In Rebma
Reinvigora
Silent Men Full Of Lessons
Since The Time Of The Devarim
That Which Crowned Our Past
The Affection I Once Bore You
The Fractal King
The Hammer That Shatters Glass, Forges Steel
The Winds of Fortune
There Are No Monsters
Too Much Baby Inside Me
Unexpected Benefits of the Apocalypse
Waiting For Sonus
Where The Dead Men Speak

Recipe for an Inventory system in Twine Sugarcube

- Posted in Coding by

The anatomy of an inventory system: (a) the arbitrarily long return function (b) creating the YourInventory passage with a [noreturn] tag (c) creating the StoryMenu passage so we can link to YourInventory (d) give the player some starting inventory items (optional)


(a) The Arbitrarily Long Return function

/* Trigger the following code at the start of navigation to a new passage. */
$(document).on(":passagestart", function (event) {
        /* Make sure the current passage doesn't have a "noreturn" tag. */
        if (!tags().includes("noreturn")) {
                /* If it doesn't, then set $return to the current passage name. */
                State.variables.return = passage();
        }
});

In case the above inline code doesn't display correctly, or breaks at some point, here is the Github gist of the above Arbitrarily Long Return function.


Next I provide the code for the YourInventory passage and the two widgets it makes use of.

the passage code:

<<nobr>>
<<if $inventory eq undefined>>
Inventory is undefined
<<else>>
<<InventoryItemCount>>
<<InventoryItemListing>>
<</if>>
<</nobr>>

and the code for the two widgets:

<<widget "InventoryItemCount">>
/* This widget prints a message to the browser window telling the player how many items are in her inventory. I still need to add the Twinescript needed to accomplish this -- but all I have to do is copy/paste it from the YourInventory passage. */ 
<<nobr>>Your inventory contains:
<<if $inventory.length lt 1>>
nothing
<<elseif $inventory.length eq 1>>
1 item
<<else>>
<<= $inventory.length>> items
<</if>>
<</nobr>><</widget>>

<<widget "InventoryItemListing">>
/* This widget prints the inventory's items,
one per line */
<<nobr>><<if $inventory.length eq 1>>
$inventory[0]
<</if>>
<<if $inventory.length gt 1>>
<<= $inventory.join(`<br>`)>><br>
<</if>>
<</nobr>><</widget>>

And, against future need, here is a gist of the above passage code and code for the two widgets.

One option for making the YourInventory passage available during play is to add the following line to special passage StoryMenu:

<<link "Inventory">><<goto YourInventory>><</link>>

One way to give the player some beginning inventory items would be to set them in special passage StoryInit:

<<set $inventory to ['a canteen', 'a pocket knife', 'a handkerchief', 'a flashlight', 'a revolver']>>

I found some old Harlowe example code for Twine

- Posted in Coding by


I found my old Harlowe examples for Twine, and threw them up on a couple of servers.

Map of A Campfire Tale

- Posted in Coding by

I continue working on a Sugarcube tutorial for my friend, Deonna. Here is a map of the Twine passage layout as of 4/14/2025. On that same date, source code (JS and twinescript/twee3) files come to 222 Kb.

Change font face and size in Twine with Sugarcue

- Posted in Coding by

Thanks to Josh Grams, I now understand how to set up players/readers of my twines with the ability to change font face and font size. Below I link to the scripts you need to drop, respectively, into the javascript and stylesheet special passages in the desktop Twine 2.10.0 app. Here is the zip containing the needed JS and CSS. I host a demo of this here and here, and mention it in my Twine Tidbits on the local copy of my blog.

A sugarcube widget to show the current passage's code-behind

- Posted in Coding by

Here is a widget for Sugarcube that will display the current passage's code-behind:

<<widget no-wiki>>
    <<print '<nowiki>' + Story.get(passage()).text + '</nowiki>'>>
<</widget>>

Happy Are The Harrassed for the Sake of Righteousness

- Posted in Coding by

Today's lesson: Happy Are The Harrassed for Righteousness Sake Matthew 5:10

Background text:

Zechariah 9:9
Matthew 21:1-11
Already examined by Jewish officials of the Sanhedrin (Matt. 26:57-67)
Already examined by Pontius Pilate (27:11-26)
Jesus is sentenced by the procurator to be crucified
Paul describes Jesus' voluntary humility (Philippians 2:6-11)

Page 2 of 11