+2 votes

Hello everyone.
I created a mock up of a chess-based game. The game reads the definition of all the pieces from a JSON at the start of the game.

It works all just fine when I am in Godot, but when I export the game (I tried export in HTML5 and MACOsX), it seems it cannot read the JSON and gives me the following errors:

**ERROR**: Condition ' !f ' is true. returned: String()
**ERROR**:    At: core/bind/core_bind.cpp:1597:get_as_text() - Condition ' !f ' is true. returned: String()
**ERROR**: **SCRIPT ERROR**: Invalid call. Nonexistent function 'keys' in base 'Nil'.
**ERROR**:    At: res://scenes/Model.gdc:40:_ready() - Invalid call. Nonexistent function 'keys' in base 'Nil'.
**ERROR**: **SCRIPT ERROR**: Invalid get index 'pos_in_the_grid' (on base: 'Nil').
**ERROR**:    At: res://scenes/World.gdc:44:_ready() - Invalid get index 'pos_in_the_grid' (on base: 'Nil').

you can see the error here: https://notapixel.itch.io/summon-or-move
I left the debug option in order to see the errors.

The code is here
https://github.com/notapixelstudio/chess-kingdoms/blob/57a0e404161deb0e64f9a4102020561c44f85ca3/scenes/Model.gd#L11
https://github.com/notapixelstudio/chess-kingdoms/blob/master/scenes/Model.gd#L184-L195

I can't wrap my head around this. Please can anyone help?

P.S.: The resource of the JSON is correctly exported, you can find the structure of the project and the files in the download section.

in Engine by (27 points)

1 Answer

+2 votes
Best answer

Fill the field for exporting non-resource files at Export > Resources

enter image description here

And there was a custom (tiled) importer which makes json handled as resource.
so, need to make not to handle it by renaming extension, like .json_data

by (9,690 points)
selected by

I just saw your repo, and I found importer="vnen.tiled_importer" in .json.import
I guess it's not about tiled, but the custom importer handle this as resource.
so after all, it's renamed and moved .import
if you need that custom importer for your project,
try different extension name for your data like piece_def.json_data

Your trick did work! But it is weird that the plugin has the power to hide all the json from the export.
Mmmm I will open an issue in the github of the tiled_importer.

If you edit your answer with this trick, I will solve this question.
Thank you Volzhs

added about importer problem to answer. :)

I ran into this same issue. Could you point me to the issue filed for the importer? This would not have been easy to have figured out what was going on on my own, and I would like to make sure that issue gets attention.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.