Twine

Alternative Notification Macro for SugarCube

To display notifications in MindWare, I have created an alternative version of ChapelR’s excellent Notify macro. The new macro differs from the original in two important ways:

  1. Close button: In my version, notifications don’t close automatically. Instead, the user has to click a close button. This is to prevent situations where the player doesn’t have enough time to read the information in the notification, especially in cases where the content is crucial to the gameplay or story.
  2. Multiple notifications: Unlike the original macro, which replaces the existing notification with a new one, my macro supports the display of multiple notifications at once. All displayed notifications can then be dismissed with just one click on the close button.

Here’s an example of the notification macro being used in MindWare (version 0.0.2):

Continue Reading

How to Avoid JavaScript Scope Issues With Twine 2 (and SugarCube)

You’re using Twine 2 with the SugarCube story format for your interactive fiction story, but JavaScript is throwing curveballs your way. Functions that work like a charm elsewhere mysteriously trigger cryptic error messages. The culprit? JavaScript scope.

Let Your Functions Mingle

The Story JavaScript area, any JavaScript file in the compile path of a Twee notation project, or code written within SugarCube’s <<script>> tags operates in a “Private Scope.”

Imagine a private scope in JavaScript like a private room in a house. It’s a space where everything you put inside (your functions and variables) is only available to those who are inside the room. This privacy sounds great for security, but not so much when you want your code to mingle with other parts of your Twine story.

Continue Reading
Scroll to top