Skip to content

Edit your visual novels on Twine and execute then on the Monogatari engine.

License

Notifications You must be signed in to change notification settings

haroldo-ok/twine-monogatari

Repository files navigation

Welcome to twine-monogatari 👋

Documentation Maintenance License: MIT Twitter: Haroldo0k

This Twine 2 story format allows one to use Twine to create Visual Novels for the Monogatari engine.

Based on Twison.

Demo

There's a demo available at: https://haroldo-ok-2.github.io/twine-monogatari/v0.2.0/demo.html

Youtube video for version 0.1.0: https://www.youtube.com/watch?v=cNW5hKvAsTo

Install

  1. Open the Twine 2 online editor: http://twinery.org/2/;
  2. On the left hand side, click on "Formats";
  3. Click on "Add new format";
  4. Inform the URL: https://haroldo-ok-2.github.io/twine-monogatari/v0.2.0/format.js
  5. Click on "Add";
  6. Select "twine-monogatari 0.2.0".

Alternately, you could import the demo (https://haroldo-ok-2.github.io/twine-monogatari/v0.2.0/demo.html) on the editor.

Basic usage

  • It is recommended to read the Monogatari documentation, specially the "Script" section, in order to have a better idea of the available commands;
  • The initial passage must be called Start;
  • Passage names must contain no spaces;
  • In order to define various Monogatari declarations, you can use special passages like [Scenes], [Characters], [Images], [Sound], [Music], and so on; those declarations can be made in either JSON or YAML formats; example:
e:
  Name: "{{evelyn_name}}"
  Color: "#00bfff"
  Directory: Evelyn
  Images:
    Normal: normal.png
    Mad: hmph!.png
    Doubt: uhh.png
    Disapointed: ngggg....png
    Happy: hehehehe.png
  • Also, in order to set various Monogatari settings, you can use a special passage named [Settings], also in either JSON or YAML formats;
    • The most important setting you must define is AssetsPath.root, that points to the base URL from the site the assets will be pulled from, like for example:
AssetsPath:
  root: http://www.haroldo-ok.com/twine-monogatari/v0.1.0/Monogatari/assets
  • Twine links are turned into Monogatari choices, and can contain conditions:
[[One choice->SomeTarget]]
[[Another choice->AnotherTarget]]
[[Optional choice |? storage.testCount > 2 ->SomewhereElse]]
  • Arbitrary JavaScript code can be included as Markdown code blocks, like so:
	```js

	storage.player.name = 'Bob';
	storage.testCount++;

	```

	Hello, again, {{player.name}}.

	You've come here {{testCount}} times.

	jump SomewhereElse
  • Here's a more complete example:
	```js

		storage.player.name = 'Bob';
		storage.howManyTimes++;

	```
	
	You've been here {{howManyTimes}} times.

	play music Theme
	show scene Classroom fadeIn
	e Hello, {{player.name}}!

	```js

		storage.evelyn_name = 'Evelyn';

	```

	show character e Normal center fadeIn
	e I'm {{evelyn_name}}.

	[[Test menu ->TestMenu]]
	[[Continue ->Continue]]
	[[Secret |? storage.secretsFound > 4 ->Secret]]

Development

Installing

git submodule init
git submodule update
npm install

Running

node build.js

If you want to hack on this tool itself:

  1. Clone this repo and run npm install to install dependencies.
  2. Make your changes to the unminified code in the src folder
  3. Run node build.js to compile your source into a format.js file that Twine 2 can understand. Alternatively, you can run node watch.js to watch the src directory for changes and auto-recompile every time you save.

Run locally

Installing

git submodule init
git submodule update
npm install

Running

npm start

Running npm start will start the watch.js auto-compile behavior, and also start a local web server that serves the compiled format.js file. By default, this will be available at http://localhost:3000/format.js. Add that URL as a story format to your copy of Twine 2; every time you save a source file and then re-generate the "Play" view of your story in Twine, it should use the latest version of your code.

This is easier to do with the browser-based version of Twine 2 than with the downloadable copy, as you can just refresh your output page and it'll use the latest version of Twison.

Run tests

npm run test

Author

👤 Haroldo O. Pinheiro

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Haroldo O. Pinheiro.
This project is MIT licensed.