• Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM [SOLVED] Why should I use get_string_async over get_string?

Dr_Nomz

Member
The manual says it's ONLY for debugging, but why? What's so different about the two? Does it matter?
 

Binsk

Member
One is synchronous (halts the game), the other is asynchronous (doesn't halt the game).

I don't know if there are background reasons as to why they changed them to say "debugging only" but it didn't used to be like that.

Maybe there are some platform specific reasons that halting the game like that would be bad.
 

Mert

Member
get_string simply stops the game and waits for your dialog to be completed. This can cause many issues in your game and can even cause a crash.

It is only used for debugging because it is easier to get a simple string, quick and fast.
 

Binsk

Member
get_string simply stops the game and waits for your dialog to be completed. This can cause many issues in your game and can even cause a crash.

It is only used for debugging because it is easier to get a simple string, quick and fast.
Enlighten me, how could this possibly cause a crash if it literally stops processing for the entire game?

Genuinely curious here.
 

Mert

Member
Enlighten me, how could this possibly cause a crash if it literally stops processing for the entire game?

Genuinely curious here.
Logically, it shouldn't be. That's why I wrote
can even cause a crash.
I believe this is because of interrupting other processes happening in the background.
I'm writing this as an extension maker, so I have some knowledge about this topic :)
 

Binsk

Member
GM is primarily single threaded, though. The audio and physics are on separate threads so I suppose if you are using physics things might get wonky?

I believe @Nocturne wrote the docs, maybe he knows why.
 

FrostyCat

Member
One is synchronous (halts the game), the other is asynchronous (doesn't halt the game).

I don't know if there are background reasons as to why they changed them to say "debugging only" but it didn't used to be like that.

Maybe there are some platform specific reasons that halting the game like that would be bad.
get_string() and other similar synchronous message functions became noted as "debug-only" after iOS store, Google Play and other app stores moved to ban blocking messages starting around 4-5 years ago. They are known to cause ANRs on those platforms if allowed to display for more than a little while, but they still get to stay because they are too helpful in conventional debugging to axe completely.
 
Top