Show Text from script

I want to have dialogue as part of a script, but I can't figure out how to get an equivalent to the event commands show text and show choices. I assume it has something to do with the Window_Message class and the $game_temp.message_text variable, but all I manage to do is to display a single message window that then repeats itself when you hit enter.

Original thread: https://forums.rpgmakerweb.com/threads/show-text-from-script.59386/