Using Harlowe 3.0 in Twine

I would rather stick with JavaScript…

Thaddeus McCleary
mentor-game-impressions
3 min readOct 4, 2019

--

Take a look at this masterpiece:

Even though Twine outputs HTML5, its game engine uses cryptic syntax like that instead of JavaScript. Of course, you can still use HTML and JavaScript in Twine, but you lose the linking and “macros” that are supposed to make Twine an easy platform for creating non-linear narrative games.

Let’s Stick with Web Standards

The problem with trying to create an alternative scripting language is that the web already has one. Though JavaScript may have its quirks, it has powered interactivity on the World Wide Web since the 90s. I dare you to disable JavaScript in your browser and try to visit your favorite websites.

Settling with Harlowe

Though I initially wrote my countdown feature for Twine in JavaScript, I had difficulty getting it to connect to the DOM elements in my scene. That meant I had to dig into the Twine Wiki to try to convert my JavaScript to the Harlowe syntax line-by-line. This also required me to deviate from HTML, the markup language of the Internet, and to implement Twine’s templating instead. Remember, all of this was to create something that was going to be exported in HTML5 (as well as CSS and Javascript) anyway.

Twine does provide an interesting layout to review.

Is there a case for using something other than plain HTML, CSS, or JavaScript?

Web frameworks such as Ruby on Rails and Django have allowed people to create powerful web applications in other programming languages and markup. Even modern JavaScript frameworks such as Vue, React, and Svelte introduce different syntax styles and templating.

Rich Harris, the creator of Svelte, has made a strong case for frameworks that focus on the developer experience over the expectations of a browser. Svelte aims to allow developers to write and structure an application in a way that may be easier for a human to design and maintain, while compiling to plain (and efficient) HTML, CSS, and JavaScript to keep computers happy.

I am currently working with my son on a game in plain (“vanilla”) JavaScript after several years of experience working with web frameworks. It is easier to see now how these abstractions have helped me focus more on the design and functionality of my projects rather than debugging trivial errors that usually amount to missing punctuation.

The problem is that Harlowe is not more efficient and forgiving. The syntax is much more complicated and less readable. As an abstraction of JavaScript, it does not provide any features that JavaScript does not already have; rather, it provides fewer built-in methods.

Directory Explorer

The result of this effort was a very simple game prototype. Though the game idea is based upon typing, being forced to use Twine limited the prototype to mouse clicks.

I would rather use JavaScript…

--

--

Thaddeus McCleary
mentor-game-impressions

English Language Instructor, Developer, Instructional Designer