Understanding the Engine Logic Behind prompt.ts and game.askForString()

Hi Richard (and anyone from the MakeCode team),

In my earlier topic here: Trying to Learn How Richard Builds Engine-Level Code like controller.ts I’ve been asking about building engine-level systems like controller.ts.

This time, I’m curious about prompt.ts — specifically, the function that asks the player for a string (game.askForString()).

I’m not asking how to use it — I want to understand how the internal logic was implemented:

  • How does it store the prompt state?

  • How is it hooked into the game’s update loop?

  • How does it capture input events and draw the UI?

  • How does it finish and return the value to the caller?

If possible, I’d love a simplified breakdown or pseudo-code showing how you designed it so it feels like a built-in engine feature.

Thanks!

1 Like

If @richard or @joey can help, that would be great — if not, that’s fine too.**
I’m trying to learn how Richard builds engine-level code. The link wasn’t working before, so here’s the correct clickable version:
Trying to Learn How Richard Builds Engine-Level Code like controller.ts - Arcade / Help - Microsoft MakeCode

You can also check my other responses there. If you have any questions, feel free to ask.
I appreciate your help — thanks and bye for now!

This would be cool to understand as I’m trying to make a custom version of the prompt.ts code with custom art and font.

1 Like

Yeah, I am still learning how they code prompt file with a lot of lines in just an hour as well, but I just hope that @Richard or @Jwunderll one day can do it.