The program does not wait for the completion of reading the file

Hello everybody. When I use this command that you see in screenshot (Read) with which I go to read the data previously saved in the mobile phone, the program continues its activity without waiting for the completion of the data reading. In fact, the variable is empty.
To avoid this problem, I had to use a timer that delayed the continuation of the program by a few seconds. In this way the variable loaded the data from the mobile.
Is there any command that checks that the data has been loaded before continuing the program?

your continue events can be a subevent of the condition:
Variable(alfaVar) is not = “”

but i am surprised that you have this issue.
I thought GD only continues to the next step, after finishing the previous one.

1 Like

GDevelop starts reading the data, but it doesn’t wait for the reading to complete, it moves on. This I have already born in the previous programs, for this I had to resort to the Timer to give time to acquire the data. But it seems strange to me that there is not a command that checks that the data have all been read before proceeding.

Try adding a condition in that action like Key “AltaGroup” exists in Storage “Alfa”

Not for asynchronous actions, but in that case it is weird indeed as this action isn’t asynchronous

Default values of variables is “0” actually I think, not “”

if the string to be read is short there is no problem, but if the string becomes longer, then the program does not have time to read it for the next step. Example: Step 1) read the string; Step 2) divide the string into 4 pieces and divide them into 4 variables. (Here. At this point the 4 variables are empty), if instead: Step 1) reads the string; Step 2) a Timer is delayed by 2 seconds; Step 3) divide the string into 4 pieces and divide them into 4 variables. (Here. At this point the 4 variables contain the data read).

For completeness I tell you that I check the execution without a timer with the “Debugger”, I notice that the 4 variables are empty, but the read string contains the data. This means that while “Step 1)” is reading the data, before it finishes, “Step 2)” is activated which divides the string (which obviously at that moment will be empty because "Step 1) is still reading).

I don’t know if I was clear in the exposition.

It is not an insurmountable problem, because in any case it is easily solved by adding a timer to give time to load the data. My question was just to find out if a function was already set up to control the reading of the data.

The loading data is async so even adding a timer doesn’t ensure the data will be loaded before the timer ends. I don’t have this problem in any of my games I can not point you in the right direction but I really want to know how this thread is solved.