Note:
- 2020-02-24 - Several things have changed since I wrote this back in 2017. I suggest checking out AnotherEpigone's comment below before trying to follow this guide.
You can download Tweego from the (hard to find) Tweego page on the Motoslave website. Compiled executables are available for Windows, Mac, and Linux, or you can follow the link on that page to Bitbucket to compile it yourself from source (instructions on Bitbucket).
There is no installer. Once you download the executable, add it to your PATH
and you're all set to use Tweego...
Sort of.
Tweego doesn't actually come with any story formats, meaning you can't actually compile a project with just the executable. So download the format(s) you want (we'll be using SugarCube 2.20, which you can download here). For convenience, you should create a folder and keep your story formats in there.
Now, set the TWEEGO_PATH
environment variable to the folder containing your story formats so Tweego knows where to find them.
There is a flag (-f
or --format=
) in Tweego that allows you to specify the storyformat you want to use as a command line parameter. If none is provided, it defaults to sugarcube-2
. Sounds like what we want since we're using SugarCube 2.20, but it's not. And, at least for me, the command line flag didn't work.
So we're screwed, right?
Well, not quite. Turns out there is another environment variable (TWEEGO_FORMAT
) which you can (and should) set which specifies the default story format Tweego will use. For SugarCube 2.20, we want to set it to SugarCube-2
. Yeah, capitalization matters.
If you have other formats in your formats folder and want to know what they're called, use tweego --list-formats
.
And that's it! You now have a working installation of Tweego with SugarCube 2.20 (or whatever format(s) you're using).
If you're like me, you won't be happy until you can edit this in your text editor of choice with sweet, sweet syntax highlighting. In that regard, I can help you set it up in VSCode or Sublime Text and point you in the right direction for everything else.
In all cases (probably), you'll want some sort of .tmlanguage file that provides syntax highlighting for .twee, .tw, and/or .tw2 files. Here are language files for twee and twee2. Both are designed for and have instructions for installation in Sublime Text, and both support SugarCube (though I prefer the former in that regard). The twee2 one adds support for the new story format, Harlowe.
If you use an editor other than Sublime or VSCode, you'll have to figure out how to get the .tmlanguage files installed there. Since I use VSCode, I'll explain how to set it up...
To get language highlighting working in VSCode, you need to turn the .tmlanguage file into an extension. Luckily, this is easy to do by following the intructions here regarding "New Language Support." You'll probably want to fill in .tw,.tw2,.twee
for the file extension prompt.
Once you've followed those instructions and turned the .tmlanguage file into an extension, you'll want to go ahead and toss that extension into your extensions folder (usually ~/.vscode/extensions
) and restart VSCode. When the editor opens again, you're syntax highlighting extension should be active.
Thank you, i was looking for how to add Syntax Highlighting for Twee2