Can't load json file into yarn editor in Gdevelop

So in theory I should be able to type up my dialogue in VS code with the yarn extension and then save it as a json file. And then when I’m in gdevelop and I choose a file to load, I choose my json file. Except when I do that it just loads a blank file.
Me choosing the file

and then once i click the ‘edit with yarn’ button i get this

Everything is just complete gone.

But in VS code it looks fine, i have the right syntax (as far as i can tell) the node is showing properly and all

Although I did notice then when I try to preview it, it says it cant compile and to check for problems but there aren’t any errors that I can see.

So I’m really not sure what I’m missing here. Would really appreciate some help with this! Thank you!

Unfortunately, folks here won’t be able to assist with the Visual Studio errors.

That said, keep in mind that Gdevelop uses Bondage.js, not yarn spinner directly.

There may be syntax changes as Yarnspinner has had a rewrite since the last main bondage.js update.

You might try making the dialogue in the yarn editor in-engine first and then saving it. it will dave as a json, you can then open that and compare.

I’m not sure what Bondage.js is.

I did try making the dialogue in-engine and then opening it in visual studio to edit but it completely changes the formatting.

In-engine it looks like this (the first node)

But the json file, when opened, looks like this

with the first chunk being my first node. The formatting is all off and it looks like way more coding than I’m wanting to do. I like using the in-editor yarn extension, the underlying issue is that i can’t access any of my nodes once I submit them because I can’t scroll/pan the area when I try to reopen and edit it. So I thought I’d try typing it up with the yarn extension in vs code, save as json, and then import it into the engine but that doesnt work either. This was the back up choice, if I can figure out how to fix the scrolling issue I’d much rather continue to use the editor in-engine since that’s about as much code as I’m wanting to write lol

It’s a separate library used to adapt the Yarn dialogue format to Javascript, basically a port (and then separate project) from the original Yarnspinner.

That said, it looks like whatever add-in your using is exporting it into a format specific to VScode or that addin. (JSON is just a method of storing data, not a defined file format/structure) However, you can just import the direct yarn file.

Here’s how you can do that:

  1. Open the dialogue editor in GDevelop. This will need to be the Create with yarn, you will not just be able to browse to your exported yarn file.
  2. Click the File menu on the upper left.
  3. Click Open
  4. Browse for your Yarn file. Make sure it’s exported as pure Yarn syntax and not json. Even just copying/pasting from the VSCode window should be fine.
    (here’s an example of what this yarn file looks like)
  5. Select the Yarn file to import.
  6. Click OK. The data in the file will be loaded and override whatever is currently in the editor.
  7. You can now save the file and it’ll be stored in a json

Edit: That said, if you’re not able to scroll the yarn editor, and you’re on version .150, you might need to investigate more, i’ve now tested on tablet (old Win 8), my laptop (Win 11), and my desktop (win 10), all with different mice/inputs and I"m able to move around. If for some reason Alt+Click isn’t working for you, you should also just try Middle-mouse button (click in the mouse wheel) and drag instead.

Oooh, I thought json was a format/structure, thank you for clearing that up!

I followed these step sand that worked perfectly, thank you!

I’m in version 0.4.116 . I did some testing and it seems to be some kind of bug. It works when I create a yarn file, but once I click save and apply, if I try to go back in to edit, it no longer works. However, if i double click into a node, and then while in that node, go to the search and hover over the name of another node, the view port will snap to that node and that seems to jumpstart the functionality again? So if I exit out of the node i originally went into I can pan/scroll again. But I have to do that every time I go into edit a node. (Also the mousewheel doesn’t work either, that was one of the first things I tried. It doesnt work to click and drag , unless I do this hack, and it doesnt scroll in or out properly, it will only zoom out my lines attaching the nodes but not the nodes themselves, unless I do this hack lol.)

it’s kind of a silly bug but i’m glad I found a relatively simply (if annoying) work around for it. I’m also glad I can now just edit my yarn file in vs code if needed, so thank you again for that help!

1 Like