Jump to content

RPY-eBook - a C++ .rpy to eBook-friendly parser


Slynch

Recommended Posts

Hello again, Fuwanovel forums!

Just stopping by incase anyone is interested in a project I'm currently working on. It's a C++ parser that reads through uncompiled .rpy code and filters out all the unnecessary text, and formats the necessary parts into a plain-text file for further formatting, but the text file will work fine on a Kindle as-is. A technical wizkid can probably program a regex to do the same job, but this is much easier to pick up for the user. 

Please note that the software is not designed to 1:1 convert script; it is designed to cut the amount of time required to convert a script to eBook manually by roughly 66% by doing the most tedious parts for you. It still requires about an half-hours work to trim the script down to the relevant parts.

I do not and cannot condone use of the software with any game you yourself do not have permission to modify/reverse-engineer. 

The readme on the Github should answer any questions but if you have more, feel free to ask away! The project is open-source and covered by MIT (to comply wtih Ren'Py license) for you to do as ever you like.

https://github.com/Slynchy/RPY-eBook

Binaries are included in the "Release" section of the Github page, although for scripts that require a bit more configuration you might need to recompile with modification to the DebugStrings code. Here's an image of a test script I ran it through:

Spoiler

QOBdR9h.jpg?2

EDIT: Removed PDF support; wasn't working out :) 

Edited by Slynch
Link to comment
Share on other sites

If anyone's interested, I just pushed a binary release for Windows for anyone who doesn't want to compile their own code; you can find this on the releases section of the Github page. I'm currently reading Hanako's route of Katawa Shoujo from this tool, so I know it works if setup correctly!

Link to comment
Share on other sites

19 hours ago, Scorp said:

This would be a bunch of unreadable mess if you parse something complicated with lot of flags, like Remember11.

Depends on how the flags are placed into the text. Currently working on making the parser work with KEY scripts, and they have the flags preceded by a backslash, whereas with Ren'Py, most (if not all) of the flags are within {} parentheses. If the flags in Remember11 are placed within {} then the parser would work fine. 

But hey, won't know until it's tried! :) 

Link to comment
Share on other sites

18 hours ago, Slynch said:

Depends on how the flags are placed into the text. Currently working on making the parser work with KEY scripts, and they have the flags preceded by a backslash, whereas with Ren'Py, most (if not all) of the flags are within {} parentheses. If the flags in Remember11 are placed within {} then the parser would work fine. 

But hey, won't know until it's tried! :) 

I mean you want to make a book from VN, If there is complex flags, like:

show text
flagA+1
show text
flagb+1
if flagb=30 show textA else show textB

it would be not a book, but a bunch of barely connected text lines.

Link to comment
Share on other sites

On 04/06/2016 at 11:22 AM, Scorp said:

I mean you want to make a book from VN, If there is complex flags, like:

show text
flagA+1
show text
flagb+1
if flagb=30 show textA else show textB

it would be not a book, but a bunch of barely connected text lines.

Oh yes, it definitely requires a bit of elbow grease first; the script needs to be trimmed to exclude content from branches you don't want (e.g. remove textB if you want to keep textA). But it's a 20 minute job, depending on the complexity :) 

Although, you say "you want to make a book from VN", but as I said I already have; I am actively reading an arc from Katawa Shoujo from an output produced by this tool, so I know it works (if the elbow grease is applied... ;) ). The tool isn't necessarily designed to 1:1 convert it (although I did prototype a version that could, albeit poorly) but is designed to help convert it. God knows how long it would take to manually extract lines of dialogue and format them into a readable format, even with a decent regex; this tool was made to heavily reduce this time :) 

KEY scripts are a pain in the butthole, though. Whereas with Ren'Py there's an indicator as to where dialogue jumps to based on decisions, KEY scripts do not; they are just simply lines of strings, and the only indication of where the dialogue jumps to is if there is a comment that says it  :unsure:

At any rate, I would love to make/provide presets for different Ren'Py games but because I am unsure as to the legality of this, I've made my code as "vanilla" as possible, copyright-wise.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...