Twine to Ren'Py tool

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
ludowoods
Newbie
Posts: 2
Joined: Wed Jul 07, 2021 12:11 am
itch: ludowoods
Contact:

Twine to Ren'Py tool

#1 Post by ludowoods »

Image
Download on itch.io

The Twine to Ren'Py tool allows you to write a simple Ren'Py game but with the visual outlining of writing in Twine. Only after searching the forums did I realize this had already been done, but also interestingly it seemed to only support Twine 1. My version is a little more bare-bones (I created it to support my writer on my current project) but works with Twine 2 (though only tested with sugarcube). It will only be lightly supported, but I'm open to adding features if people will find it useful.

Features:
  • Converts Twine-like choices into Ren'Py menus
  • Replaces special characters and passage titles with Ren'Py safe terms
  • Add custom replacement terms
  • Use passage tags to break up into separate rpy files
  • Includes demo for writing Ren'Py games in Twine
Twine code setup

See the included Demo.html file for how to set up your Twine file for proper exporting to Ren'Py.

Run into a bug?

Drop the steps to reproduce the bug in the replies.

Suggestions?

I won't be creating a robust, fully featured tool, but if you have a suggestion for a feature that would help you with a project feel free to let me know in the replies!

User avatar
ludowoods
Newbie
Posts: 2
Joined: Wed Jul 07, 2021 12:11 am
itch: ludowoods
Contact:

Re: Twine to Ren'Py tool

#2 Post by ludowoods »

Hey all!

Twine to Ren'Py 1.2 is out!

Here's the changelog:
  • Convert Twine variables to Ren'Py including:
    • Setting variables
    • Using variables in text
    • Option to define default statements for all variables at the beginning of the script
    • Set these to a default value or just leave them as what they're defined as in Twine
  • Converts Twine conditionals to Ren'Py
  • "Twine mode": If you originally wrote the game for Twine, the tool will add quotes around every single line and make all other quotes work inline for Ren'Py
    Basically, if you wrote your game for Twine, your game will now work out of the box in Ren'Py. I have a feeling most people who used the tool when I first launched it probably tried it out with their existing Twine games and then realized it didn't add quotes the way Ren'Py would use them--honestly a huge oversight on my part because our workflow for Salvage was only ever with Ren'Py in mind.
    However, I assume most people who intend to use Ren'Py are using speaking characters, so this effectively treats every single line as if spoken by a narrator. Some games work like that! If you're creating IF focused games this tool will be more useful for you now.
  • Character definitions
    • By request! I also noticed this was actually reported as a bug a bit ago, but kudos for the detailed report and suggestion for features.
  • Set the name of the first file
    • By default the tool just grabs the title of the start passage, but now you can change your starting "Untitled_passage.rpy" to "start.rpy" if you wish to.
Some existing known bugs that may or may not be fixed:
  • Latin characters get chewed up in the encode. This actually caused some problems for the slanted quotes as well, but the fix was nebulous. I tried to pass Latin characters in and out of the replace, but it doesn't work after compiled with pyinstaller, so the workaround might be passing their unicode string > actual characters as the replace. when I was digging into it I learned that some of the encode/decode bugs the tool ran into seemed to be fixed in python 3. I think to truly fix it, the tool would need a full overhaul for python 3 which would require entirely redoing the beautiful soup html parse. I think this is doable but maybe a project for the future, as I'm hesitant to change when most of my tool libraries for the game we're on currently use 2.7 and would mean redoing all of our existing tools.
In addition: I've released the Twine to Ren'Py tool source code! Duct tape heavily included.

You can find it on GitHub here!

Note that this actually uses Python 2.7 to run. In the future I think the tool would run into less decoding/encoding issues if it was re-written for Python 3, but I'm keeping as 2.7 just to maintain compatibility with other tools in our pipeline right now.

I had a little bit of initial testing, but I'm sure this release will still have some bugs. Please feel free to drop reports in the itch.io comments or send them to me at the email on the page. Thanks again for your support!

Post Reply

Who is online

Users browsing this forum: No registered users