This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hey people,

I'm having a strange error saving a game to a .json file.
The error I'm getting is "ERROR: storeline: Condition ' !f ' is true."
It seems to come from the line of code "save
This is not crashing the game and the game saves and loads normally (both exported and inside the editor).
It's really annoying though.
Any clue to what could be causing it?

The code:

func saveGame():
    var save_game ="user://", File.WRITE)

*fases, picks and disp are just lists with 1s and 0s


in Engine by (26 points)
edited by

1 Answer

+1 vote
Best answer

I checked core\bind\corebind.cpp ( ) and it seems that this indicates that your file (savegame) hasn't been successfully opened before calling storeline.

This may be due to multiple reasons. (which I can't tell because you didn't post some code)
I.e.: you tried to save your savegame in a res:// path which might fail on exported projects. (res:// is readonly on some platforms).
or: you simply did not create/open the file before before the first store_line

by (3,370 points)
selected by

Hey thanks for the answer
I think I can rule out the second example
I updated my question with some code

#1: Please check the return code from open(). If it is != OK then output the error code
([email protected]#enum-globalscope-error )

#2: Personally, I think it is good style to close() the file after use. The destructor may do so implicitly but maybe it does it deferred which may lead to a problem if another file write attempt is done before the close has happened.

#3: If the messages still ocur then try to put some print() before and after the store_line() to see if the error occurs where exactly, every time (also on the first call) and if the error even happens on that spot and not in another location which you weren't aware of.

Looks like closing the file solved the problem.
Thank you very much!

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 Frequently asked questions and 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 [email protected] with your username.