Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Whats the best way to export Json?

Seems this thing is broken; https://github.com/cauli/TwineJson

I'm looking to parse Twine in Unity, Json seems like the most painless way.

Comments

  • If all you want is a way to access the content of all the Passages within a Story and you are using one of the downloadable/installable releases of Twine 2 then the simplest method to do this is:

    a. Use the Twine > Show Library menu items to open the folder/directory where the application stores your Story Project files.

    b. Make a copy of your Story's Project HTML file.

    c. Use a HTML Parser built in the programming language of your choice to parse the copy. The file's basic structure is as follows, I have added indentation and extra line-breaks to make it more readable:
    <tw-storydata name="story name" startnode="1" format="Harlowe" ....>
    
    	<style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"> .... </style>
    	<script role="script" id="twine-user-script" type="text/twine-javascript"> .... </script>
    
    	<tw-passagedata pid="1" name="name of first passage" tags="" position="1,1"> .... </tw-passagedata>
    	<tw-passagedata pid="2" name="name of second passage" tags="" position="1,11"> .... </tw-passagedata>
    
    	....
    
    </tw-storydata>
    
    the .... in the above either represents element attributes that have been remove or content.
  • This might be the way, if there is no working Json parser out there. In the end I feel that I will have to write my own custom parser anyway, but would have been nice to start this project from "already having a Json file" stage.
  • edited August 2016
    I made a Unity plugin that imports Twine stories as C# scripts, among other things it parses the story structure into a class hierarchy. It might be useful in your situation.

    Cradle (UnityTwine)
Sign In or Register to comment.