TwineTools v0.05

Prinplup

Member
Aug 6, 2016
151
292
Attached is a simple python script I use when modifying twine games. It exposes 3 functions:

extractTiddies: extracts the 'tiddlers' from the game.html file and puts a html and textual representation of their code in tiddlers.

The txt files contain prettified versions of the .html code

applyTxtChanges: applies changes to the tiddler.txt files onto the tiddler.html files

exportHTML: outputs a changed game (html) file based on the tiddlers

exportTxtChanges: Combination of both the previous two. I usually directly modify the .txt files, then save my changes by running this function.

To use, you need python and pip to install dependencies like beautifulSoup (pip install bs4). cd into the game directory, python on the file, and the rest should be relatively self explanatory.

This is very much experimental, but improvements/suggestions are always welcome. A rudimentary detection for changes in tiddler txt and html files has been introduced to speed up rebuilds.

The game will always assume you are working on modded.html, if it exists, else it defaults to game.html (both paths easily changeable in the python code). The typical workflow is to modify the .txt for a tiddler, call applyTxtChanges, and then exportHTML.

Note that this was designed with modifying the .txt files in mind, rather than directly modifying the html. Thus if you touch the tiddler.html directly, it will port to the game file. However, running applyTxtChanges will do nothing as no change to the txt file was detected.

You don't have permission to view the spoiler content. Log in or register now.
 
Last edited: