Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

I tried to use this tool to convert an existing project from Twine to Ren'Py format.  The GUI produced no error message, but no Ren'Py files were generated, either.  When the tool is run from the terminal, though, this error message is outputted:

Traceback (most recent call last):
  File "twine_to_rpy\twine_to_rpy.py", line 465, in run
  File "twine_to_rpy\twine_to_rpy_model.py", line 276, in run
ValueError: too many values to unpack

On my end, converting the demo file does work as expected (except for the part where the start.rpy file outputs test_character (without quotes) instead of either defining a character called test_character earlier in the file or outputting "test_character" (with quotes), leading to a Ren'Py error message at runtime unless the start.rpy file is manually edited).

Thanks for the bug report! I'll take a look into what might be causing the ValueError. WRT defining characters, the tool does not automatically do that, so unfortunately that's just a demonstration of how users should format their scripts with speaking characters.  What I could do instead is add an option to output the "first" .rpy file as something other than start.rpy, which allows users to enter that part of the script themselves and leaves any code in start.rpy alone, including scripts that users might add later. I think this sounds more useful for all cases, but let me know if you're thinking an option to define characters when generated makes more sense or seems like an expected option otherwise.

I think the characters thing could benefit from a dropdown setting with the following options (possibly excepting the second):

* Generate character variables, and include those character variable declarations and uses in the output.  (This would make a file that runs, and the user would be able to adjust the character variable assignments if they cared to.)
* Output character names in quotes so that they'd be strings rather than variable names. (This would make a file that runs, but with no formatting on speaker names; on the other hand, there'd be no conflict with already defined character names.)
* Use variables for character names, but do not generate a definition for them.  (This would make a file that does /not/ run unless the user has generated a separate file with character variable declarations or adds the same to a generated file after the fact.)

 The first two options would be useful for someone who wanted the generated files to "just work", and the third would be useful for someone who wanted to run the conversion tool iteratively, but didn't want to repeatedly respecify the formatting for character text output.

I'm inclined to think that one of the first two options should be the default setting.  A new user who uses the default settings on the sample Twine file should be able to end up with something that works as expected in Ren'Py (otherwise, the new user might think the tool is "broken", even if the tool is performing exactly the intended behavior).

Thank you for the detailed suggestions! They sound possibly doable, but I won't promise anything just yet until I look at it. I didn't plan to support this tool much, but I may come back to it for some other updates that I could possibly wrap into one release.

Also, in case this helps your debugging, one of the perhaps atypical aspects of the Twine file that I tried to convert is that some of the <tw-passagedata> blocks within it are of type tags="Twine.image", and they contain base64-encoded .png data rather than standard Twine scenes.  It occurred to me that the conversion tool might be choking on this type of data.

This might be easier for me to debug with a repro. If you don't mind could I ask you to send an example file to jbtuason/gmail? You can trim to just the passage with encoded strings, or just send the encoded strings + tags on their own.

The project I was trying to convert is https://azulookami.itch.io/finding-a-place (NSFW project, SFW project page).  At the time I first tried using the Twine to Ren'Py tool, the project artist had said in the comments that they were looking to convert the Twine project to Ren'Py, and were looking to pay someone to perform that conversion.  Since then, the project artist has apparently found someone to pay for that conversion (that person is not me), so my warrant for trying to do the conversion myself (getting that project rolling again faster) has been effectively obsoleted.

You should be able to find a relevant <tw-passagedata> block by doing a search for (tags="Twine.image") (without the parentheses).

(1 edit)

Thanks! Looks like the problem had to do with passages that had no links whatsoever (which coincidentally were the Twine.image ones). It's not too hard to add an option to skip them and maybe throw in options for other tagged passages to be skipped as well. However, even after that addition it looks like for this project in particular there are other possibly non-standard characters that would cause problems with the decode as well as custom macros that wouldn't make this a simple conversion.

Hello! I think that this is related to custom links anchors, like:

[[Text option to the reader|DestinationLink123]]

[[Text option to the reader-->DestinationLink123]]

The demo version and other test I did with the simple link syntax are ok. So for now, anything created with this kind of links return this error.

Hope that this help!