Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Latest commit

 

History

History
61 lines (51 loc) · 993 Bytes

README.md

File metadata and controls

61 lines (51 loc) · 993 Bytes

yarn

Generate a JSON representation of Twine flows

{
  "screen1": {
    "name": "Start",
    "text": "Blah blah blah",
    "intents": {
      "Yes!": "screen2",
      "No": "screen3"
    }
  },
  "screen2": {
    "name": "Introduction",
    "text": "Bloh bloh bloh",
    "intents": {
      "Maybe": "screen4",
      "No": "screen3"
    }
  },
  "screen3": {
    "text": "Bluh bluh bluh",
    "name": "Sorry",
    "actions" : [
        {
          "actionSequenceType": "pre",
           "actionType" : "saveItem",
           "values" : ["item_name", "photos"]
        },
        {
          "actionSequenceType": "post",
           "actionType" : "notify"
        }
      ]
    }
  }
}

Usage

From CLI

node index.js twine.html [--drop-text] [--normalize] [--lower-intents] > export.json

From code

const yarn = require('yarn')

const twineHtml = ... // Load the Twine HTML somehow
const json = yarn.convert(twineHtml)

License

MIT