Super Simple Yarn importer for parsing Yarn Dialogue Files

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by pauljessup »

So, for an RPG system I've been working on, I decided I wanted to use Yarn to build the dialogue trees:

https://github.com/YarnSpinnerTool/YarnEditor

It's pretty cool, been used in games like Night in the Woods and A Short Hike. Right now, the import is pretty bare bones and simple. You need to export the dialogue tree to a .json file. And then, in the .json file you can load various conversation nodes, and it will tell you if there are node choices (and what nodes they link to), and if they're any tags, etc.

Eventually I plan on adding in the abilities to parse lua commands inserted into the body using the command brackets in yarn (<< >>), and to be able to tag various dialogue nodes with variables, so it will only show that node if the variable is true, etc. But right now, it's bare bones, but it works great.

here's the github for my bare bones yarn parser:
https://github.com/pauljessup/yarnparser

This, combined with TileD, could possibly create an open source RPGMaker that's pretty versatile...

Once it gets further along, that is.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by pauljessup »

Okay, updated the git so now it does line traversals for the body (so you can easily use this in love.update), as well as making it so you can execute lua code you add in the commands portion of the editor (usually placed in the body text between << and >>). I think the code here is done for the public facing version- mostly because anything else I add is going to limit it to my own personal engine now. It's more versatile if I leave it open for anyone to interpret the commands, displaying in dialogue boxes, etc on their end.

I'll probably add some well documented examples to it, and then get back to integrating it into my own modules.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by yetneverdone »

Awesome. Keeping an eye on this library. Keep it up!
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by pauljessup »

Thanks!
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by pauljessup »

Haha, yeah of course I wasn't done with the public facing version. I just made it super simple to control what gets exposed when doing code commands in yarn from Lua and Love2d. And then I added a basic lua function parser...

and some other tweaks. Now to create some good examples, I have a few ideas in mind, ramping up from a simple "hello world of yarn" to a complex example involving menus and exposing functions.
pauljessup
Party member
Posts: 355
Joined: Wed Jul 03, 2013 4:06 am

Re: Super Simple Yarn importer for parsing Yarn Dialogue Files

Post by pauljessup »

And now there are four examples, that go over the basics of the yarn parser. A hello world example, a Night in the Woods style conversation example, an example of a two choice menu, and an example of executing Lua commands from the Yarn file itself.

All of these are inside the Examples folder
Post Reply

Who is online

Users browsing this forum: No registered users and 74 guests