ink icon indicating copy to clipboard operation
ink copied to clipboard

Asynchronous function execution

Open 15sawyer opened this issue 10 months ago • 0 comments

Hello, I have a specific use case and wanted to ask about the suggested solution.

Use case: At some point, I want to interrupt the story flow and wait until the player inputs something (e.g. clicks on a specific button).

Current approach: Currently, I run an external function that sets a wait flag. While the wait flag is set, no more lines are read.

Disadvantages: The disadvantages of this approach are that it requires unnecessary global variables to get some return value from code and that the story doesn't wait until the next line is read, meaning I can't use the "returned" value inside it.

In other languages, this would be solved using asynchronous functions. What's the best solution to this in Ink?

15sawyer avatar Apr 04 '24 15:04 15sawyer