Loading the value 0 from a savegame is ignored

Current behaviour:
If you “Read from XX File and store YY value in ZZ” and the value read from the file is exactly 0 then the current scene variable value remains untouched.

Expected behaviour:
The value of the scene variable should be set to 0 and overwrite it’s current value.

Use a temporary variable, set it to 0 and read the value into that variable. Then assign it’s value to that of your scene variable.

Web platform (haven’t tested this with native)
GDevelop, built 27/06/2016

Can’t reproduce it (tried Firefox, Opera and native), check if this one works:
ReadZeroBug.gdg (9.45 KB)
Press “A” to read the value and show it in the debug text :slight_smile:

Same Bug with your project file.
But upon opening GD said that the project was created with a newer version of GD. Maybe the bug has already been eliminated. Unfortunately I can’t test it with a newer version of 4.x cause I’m affected by the Linux freeze bug when opening a scene in newer versions.

I tried your project in GD5 and hitting “a” indeed showed 0.

Yup, it was fixed two years ago :slight_smile: (github.com/4ian/GD/commit/73984 … a1664b703a), you can make the modifications yourself to make it to work in your version, the file to edit is located at:


Line 227 (approximately, maybe it has changed), search for this line:

if ( i == elemArray.length-1 && currentElem[elemArray[i]].value)

And change it to:

if ( i == elemArray.length-1 && typeof currentElem[elemArray[i]].value !== "undefined")

This will make loading 0’s to work.

And change this line (253 approximately), to make loading empty strings “” to work:

if ( i == elemArray.length-1 && currentElem[elemArray[i]].str)


if ( i == elemArray.length-1 && typeof currentElem[elemArray[i]].str !== "undefined")

Cool, thank you very much :mrgreen: