0 votes

My game has a timer in it that counts down 3 seconds. At the end of the timer some objects are either removed added or both. Generally, there is not a problem with this. However, I also have a save and load function built in as well. The save is fairly straight forward saving all variables from various scenes needed to continue the game when loading. The load would load the variables and then initiate the timer above. Problem occurs somehow after the load has completed and the timer does the first 2 seconds but not the 3rd second; the game then totally crashes/stops running and dies.
From the debugger I am seeing these errors:
editor/scripteditordebugger.cpp:229 - Condition ' connection.isnull() ' is true.
editor/script
editor_debugger.cpp:239 - Condition ' !breaked ' is true.
Is there any information/documentation explaining what these errors mean?
Thanks.
Godot Engine v3.0.6.stable.official.8314054

in Engine by (15 points)

I don't really know what's happening here. Maybe a piece of code that coincides with the timer hasn't been loaded yet? A Node, perhaps?

This is code for the timeout :

func _on_CountDownStart_timeout():
    print("Hello")
    var temp = int($CountDownStart/Background/Count.text) - 1
    audio_count_down_start.play()
    if temp == 0:
        $CountDownStart.stop()
        $CountDownStart/Background/Count.visible = false
        $CountDownStart/Background.visible = false
        audio_count_down_start.stop()
        remove_child(audio_count_down_start)
        audio_count_down_start.call_deferred("free")
        if isRoundContinue:
            _continue_Round()
        else :
            _start_game()
    $CountDownStart/Background/Count.text=str(temp)

The first print statement in the function only prints twice and not a third time as expected(after loading save data). It is almost as if the function is never called the third time.

Is that how the code looks, indentations and all?

The first indent level for the function was missing, I just updated the indentation to match what it looks in the actual project.

This may be a long shot, but what if the temp doesn't reach 0? What if it reaches some other number, like -1? Also, that part about casting Count to an integer just seems out of place. I mean, if Count was a floating point number before the loop, it then becomes an integer after the loop, thus losing precision.

Yes it is not counting down to 0. I tested this by placing a print statement at the end of the function to print 'temp'. In situations when the crash occurs it counts down to 1 and that's it (does become less than 0). The 'Hello' output is not printed again which seems to indicate that the function is not even called that last time. Note the 'temp' variable is getting its value from a 'Label' which has the static value of '3' and no where else in the project is this value being changed.
I have been doing some further tests and have been able to isolate more conditions that occur prior to the crash. However, it still does not explain how these conditions should affect this timer.
Is there any documentation on errors generated by the API? I can't seem to locate any documentation on these errors or what they mean.

Don't know much about the errors returned by the editor. Maybe the signal timer became null? What you could also do is walk through the execution of the code. You could set a breakpoint in the if loop, and look at the state of the variables in the Debugger pane, to see what's going on.

I found the issue and was able to rectify it. It actually was not related to the timer. I will try summarize.
My main scene has a variable number of buttons at any one point in time. As you might have guessed from the code above the timer controls some rounds within the game. Each time the round changes, buttons from the previous round need to be removed so that new buttons can be added. This was done via a flag. However, it seems that the flag was not being updated properly for scenarios (the save/load) and therefore my cleanup function was not clearing up the unwanted buttons (call_deferred("free")). Once I rectified this the previous issue no longer occurred.
I think since these Button objects were not being cleared up this may have caused the error when more Button objects were being loaded. It was a silly mistake on my part here and I was looking at it all wrong.
@Ertain many thanks!

Glad to be of service.

Please log in or register to answer this question.

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.