This is a WIP Story Format for Twine/Tweego.
This format is intended to be a midpoint between Snowman and SugarCube. Like SugarCube, this format will be “full featured” and “highly customizable”, but it will have more JavaScript-like syntax. Where SugarCube macros are styled like HTML elements, Brick macros are styled like JavaScript function calls.
// Code within @(...) is executed as JavaScript,
// with the addition of '$' and '_' to denote story and temporary variables.
@($inventory = ["apple", "sword", "cloak"])
// "if", "for", and "while" work like their JavaScript counterparts
@if ($inventory.length === 0) {
Your inventory is currently empty.
} @else {
Your inventory contains the following:
/*
* Block-style comments are also supported.
* HTML elements are (generally) rendered directly,
* although their syntax is stricter than actual HTML.
*/
<ul id="inventory-list">
@for(_item of $inventory) {
// Story and temporary variables can be included "naked" in markup.
<li>_item</li>
}
</ul>
}
// Any JavaScript expression can be a macro argument.
// This macro will find the passage named "inventory comment"
// and print it into the current passage.
@include("Inventory Comment".toLowerCase())
// Wiki-style links of course
[[Shop]] // This will create a hyperlink to the passage "Shop"
// This will create a hyperlink with the text "Go to Bed",
// that links to the passage "Sleep"
[[Go to Bed->Sleep]]
NodeJS is necessary to build this project.
First, run npm install
(this only needs to be done after initially downloading or updating Brick).
Then, run npm run build
.
This will create a format.js
file in the directory storyformats/brick/
.
Consult Tweego's documentation on where it looks for story formats.
Make sure your StoryData
passage has "format": "Brick"
(case-sensitive) and "format-version": "0"
.
From the list of story formats, select Story Format -> + Add at the top.
In the text box, paste the absolute path of the format.js
file, prepended with file:
. So for example, on my machine, the full text has to be file:/home/chris/brick/storyformats/brick/format.js
.
I've found Twine to be very clunky when it comes to adding new formats;
I recommend pasting in the whole path at once, rather than typing any part of it into Twine.
Not yet supported. This will be supported soon, once I start publishing releases.
This is unlikely to ever be supported.