By using the Variable() expression you get the value as number and by using the ToString() expression you only convert the value to string but not getting the value as string. To get the value as string you need to use the VariableString() expression instead of ToString(Variable()) and you also need to make sure the actual value is stored in a string variable.

Also make sure to add the variable to the scene variables using the editor.Right click on the scene in project manager -> Modify initial variables Normally, if a variable doesn't exist GDevelop go ahead and create it for you on request and in most cases it helps to avoid errors with "undefined" variables but not always. In some cases even though GDevelop create the variable on request, it won't work and you get a 0 or an empty string returned as the variable is created, but not being used by the action. By adding a variable to the list of the scene variables, you can avoid this kind of errors.

Finally, to add an empty string variable to the list, just simply leave the initial value field empty. Make sure there is nothing, not even '' or "" signs. If no initial value assigned to a variable, it is going to be created as string variable.Also, in case you want to add some text as initial value, you can just simply type the text without using '' or "" signs.

User mini profile

What I don't get is the initial setup for the initial variable structureDevSaying: this is not a string variable, but a structure (i.e. a hash). I tried to leave it totally empty to start with but if this defines the field as a string, it's probably not the right thing.

New tweak is:

Do ="ca marche pas" to the text of variable structureDevSaying.textParse JSON string "{'text':'blu'}" and store it into variable structureDevSayingDo =VariableString(structureDevSaying.text) to the text of DevSyingText

=> shows "ca marche pas" in the scene.

So the second step with the JSON string "{'text':'blu'}" is not working. I tried "{text:'blu'}" or {text:'blu'} or {text:"blu"} without success

User mini profile

- Sat 17 Jun 2017, 20:11#62282
Now trying to find the best way to display a text of variable size, justified inside a Text Object: I tried adding a custom size to the Text Object but the text still displays on one line, overflowing outside of the Object. I see there is a NewLine() method on strings, but given a random string taken from a JSON, I would rather not have to parse every n characters and add a NewLine() operator after each fragment..

Is there any way to add CSS text-align:justify for the TextObject? Or at least to be able to define the new line from the JSON instead?