Send strings from Yarn to GDevelop

Hello,
is it possible to use internal links / anchors in a single Yarn node?
I think not, so I’m developing a bit complicated solution (if you have any tips they might help!)

Unfortunately I need support: How can I send strings from Yarn to GDevelop?

In Yarn I have this: <<set $Text = “Test”>>

In GDevelop I only found ‘DialogueTree::Variable(“”)’… What am I doing wrong?

Really thanks! :smiley:

Hi!

What do you mean?

Hello and thanks as always for the replies.

My idea is to create many dialogues and choices within a single node.

When you click on an option you do not go to a new node but to another point of the same node.

As far as I understand, That is not how Yarn works.

Nodes are processed just like an event on the event wheet. The whole thing is processed at once.

I do not believe what you are attempting to do will be possible in a single node.

1 Like

Yes I know Yarn and Twine, but often there are too much nodes and I don’t like disorder.

I think I found a solution, but for this I need to understand how sending strings from Yarn to Gdevelop.

How can I import them?

You cannot. Loaded dialogue data cannot be modified via events. Likewise, Yarn variables cannot be updated via events.

The closest you could do would be have your yarn file as a JSON stored as a variable, then use string expressions to slice up that variable and rebuild it with your new string. This is going to be EXCEPTIONALLY difficult as you’re going to have to know exactly where the string you want to replace is, how to slice it, and how to rebuild it. You’ll also need to stop the dialogue entirely, rebuild the string, and then restart the dialogue.

I don’t need to modify Yarn strings.

I have this:
<<set $Text = “Test”>>

How Can I store $Text into a Gdevelop string? I’d like to do this without commands.

In GDevelop I only found DialogueTree::Variable(“”)

Really thanks!

Hi, I solved the problem and now everything works fine: I can use a single node as a web page and move around answering questions.

Solution: I created a loop that exits the node, goes back into gdevelop, updates a variable and reloads the node. Here each section is handled by that variable and an “if”.

If someone has trouble exporting a string from Yarn to Gdevlop the command is this:
ToString(DialogueTree::Variable(“NameVariable”))

It is essential to remove the “$” from the beginning of the string name! That’s why I was wrong! :wink:

2 Likes