lazerwalker / twison

A Twine 2 story format that provides JSON export
MIT License
151 stars 35 forks source link

dump as JSON? #10

Closed dcsan closed 8 years ago

dcsan commented 8 years ago

it seems this relies on client side javascript to run

is there a way to get the JSON output from a server side script? or even a way to access the raw twine internal XML just as a pure data dump?

ideally so I could do something like curl $storyUrl > file.json

I want to use the twine editor/authoring tool, but building my own runtime. currently a server cant really talk to this export tool, it has to be done manually in the Twine UI to "export as JSON..."

lazerwalker commented 8 years ago

The reliance on client-side javascript comes from Twine 2 itself; the only official hooks for custom story formats in Twine 2 are all based on client-side JavaScript.

More importantly, Twine 2 stories are only stored locally in your browser's LocalStorage, not online. Building a tool that does e.g. curl $storyUrl > file.json isn't (as far as I can surmise) technically possible, since stories are stored within your specific browser rather than Twine's servers and URLs only work locally within that browser. (You can test this yourself! Take a Twine story that you've been working on, and try opening that URL on another computer, or even a different web browser. It sadly won't work.)

Even if you're okay with only being able to use such tool on the computer that's authoring the stories, writing something that manually reads your browser's LocalStorage sqlite file (or whatever the internal representation is) sounds like a painful task.

Without having the time to dive deeply into what you're actually trying to do, I'd recommend looking into one of the two following options:

I had personally been planning on doing something akin to the second option before the project I was doing that for got put on the backburner.

dcsan commented 8 years ago

yeah, i came to the conclusion it would be easier to write my own authoring UI than try to bend the existing twine to my needs.

to that end did you come across any other tools that have similar functionality to twine?

we had some discussion here too: https://github.com/aichaos/rivescript-js/issues/22

lazerwalker commented 8 years ago

I'm actually in the process of building out my own general-purpose storytelling engine and Twine-like authoring tool suite as part of my research at MIT.

The engine's going to be open-sourced fairly soon, but it'll be quite some time before it or the authoring tools are even remotely production-ready.

dcsan commented 8 years ago

does it coincide with any of the objectives outlined in that thread on rivescript? its a fairly topical area. I'd be interested to compare design notes with you. we have a need for such tools for our english language learning adventure game, but have really just been building the minimum to develop the content.

http://ComicEnglish.com story -> http://comicenglish.com/lessons/leak/start/start

chatbots and messaging is such a hot topic this year, but the authoring tools are all mostly for very simple dialogs, like slot filling for an IoT controller, or ordering a pizza.

not actual conversations with topics and context.

separately the dialog authoring tools are pretty much hardwired and put all the burden on content writers to specify everything ahead of time like a flowchart.

there isn't really anything that makes it easier to author conversations with the flexibilty that NLP tools can provide but the creativity of a flow chart / story design tool.