Wait for a javascript late response to continue

Hi for 3 days i am trying different methods which i couldnt solve this problem…
My code goes like…

1- do some gdevelop code blocks
2- a javascript to get response from Javascript and assign it to a global variable for later use
3- change scene.

When i run this it always passes step 2 without waiting the response and assign the global value.

I guess gdevelop doesn’t wait for the javascript api response to finish.

I tested these…

1- when i don’t change the scene the variable is created after the javascript get a response approx. 5 sec. or so. (I can’t use wait because duration to wait changes undefinitly)
2- both inside javascript or in gdevelop change scene command doesnt wait for response doesnt wait and change scene instantly.

I need something like. “wait until status variable turned to true then change scene” or
" repeat until status variable turned to true and do nothing"

is there a switch code block like that in gdevelop?
I tried some while and wiat but coludnt manage it yet.

Thank you…

Found the solution…

Status variable is set to false
Status variable set to true when the response finished
“Trigger once” Trgigered the change scene when status is “true”

Thanks all

3 Likes