I'm pretty sure I've seen this done in GM using XML files in the past. That would be a good way of supporting the branching structure of such a system. Although perhaps not transparently compatible with the GM workflow, but reasonably easily transferred to one using something like XML to store the dialogue data, I could describe in rough terms how I solved this in Unity two LD's ago.
I did write it in C#, but as with any script in Unity, the variables were wonderfully brought into Unity's GUI editor for me to visually add dialogues with options and branches when the system was up and running. The only unfortunate exception to this wonderfulness was the fact that Unity for a long time has had, and according to the searches I did at the time does not plan to remove, a limit to the number of branches possible in the editor. I could have solved it by creating an XML-like system instead, but I decided against it due to the limited time of the LD competition, and rather designed the dialogues around this limitation instead – something you should be able to avoid with a system like this in GM.
Anyhow, imagine you might have an XML structure somewhat like this:
<dialogue>
<textbox character="John Smith" avatar="happy" />
<text>Oy, stranger!</text>
</textbox>
<textbox character="John Smith" avatar="happy" />
<text>Whatcha doin' here?</text>
<option text="Investigating!">
<textbox character="John Smith" avatar="suspicious">
<text>Huh? I don't want no coppers 'round here.</text>
<option text="Oh, I'm not a cop.">
<textbox character="John Smith" avatar="surprised">
Oh? Really? Well, off with ye anyhow. I ain't sayin' nuffin' to nobody!
</text>
</option>
<option text="You are under arrest." action="death-5">
<textbox character="John Smith" avatar="laughing">
Hah! You've entered the wrong neighbourhood. Come on, lads!
</text>
</option>
</text>
</option>
<option text="Eh, nothing.">
<textbox character="John Smith" avatar="expressionless">
<text>Oh. Me neither.</text>
</text>
</option>
</text>
</dialogue>
So what you need to do is parse the file somehow (I'm sure it's possible in GM if not by built-in means at least by some sort of add-on) and look for textboxes to begin with. Immediately consequent textboxes just come after each other. So the character will first say
"Oy, stranger!" with no options, you'll be able to click next, and
"Whatcha doin' here?" will be written in the following textbox, along with two options for your player to choose from:
"Investigating!" and
"Eh, nothing.".
Selecting the latter will simply have the character say
"Oh. Me neither." and then ending the conversation, as there is no more data following. Choosing the first option, however, will begin branching into more textboxes and options. If you reach the end of a tree with no specific action supplied for any option, the conversation simply ends. However, the latter branched choice of the first choice, where your player tries to arrest the character, has been set to trigger an action designated
death-5, leading perhaps to a cutscene where the thugs dispatch of your player.
Is that enough without actually supplying some code? I just wanted to try and explain the basic gist of the system.