Import Variables To Yarn

Is there a way to import variables from GDevelop to Yarn? If there is, how?

I’m making a dialogue where an npc talks to the player.

I tried to do this in yarn: NPC: Hi GlobalVariableString(PlayerName)

The expected output should be: NPC: Hi “Your Name”

The actual result: NPC: Hi GlobalVariableString(PlayerName)

  • I also tried: Hi <<GlobalVariableString(PlayerName)>> but it doesn’t recognize the command.
1 Like

There is an event sheet action that lets you set a yarn variable - it takes two parameters: the name of the variable and the value. Please read the documentation :slight_smile:

Sorry I misread your comment. Bondagejs (the parser gdevelop uses) doesnt yet support displaying yarn variables as text, so the player name syntax doesnt yet exists as a feature.

I raised a ticket for it and if bondagejs author is interested in having it, I might do a pr to add it. It has been requested many times over the years.

The syntax would be something like this:

Hello ${playerName}, how are ya?

1 Like

I made a super simple Yarn and Yarn variables tutorial in case anyone was stuck (like I was!) Hope it help beginners like me:

Also I have example code on github if anyone want it!

Video unavailable ?? :frowning:

Yes! I got a smackdown from the admin so i stopped adding links to my videos. Here ya go!