So assuming you don't wan't the player to be able to do anything outside your scripted responses (ie: no walking away, looking in their inventory or any number of things the player could freely do if they weren't talking to an npc), then I believe I have a solution for you.
I'm not sure how your scripting your npc dialogue, but for this case you'll want to use a
get input. Basically it creates a temporary 'result' variable that stores whatever the player enters next, and doesn't consider that text for any other actions. This allows you to make a completely controlled situation where the player cannot enter any commands that you don't specifically allow.
The second part is using a
switch to set up some scripted responses to the players options. You can use a series of if/elses here as well but I prefer switches in this case personally. Now something you will need to account for is that the
get input will only check the first input, so you will need a method of restarting the input section of the script when the player doesn't choose an acceptable option, which will also be used to prevent the player from leaving the conversation during the tension period, only allowing them to attempt different responses until it is resolved.
To create a loop in the conversation I would recommend creating the looping section as its own function or script separate from the rest of the related script. While it may take a little bit to figure out and get used to, I would say using a script type attribute on the npc would be the best option I know of to keep things organized. Fortunately it's not actually that hard, you will just need to create an appropriately named attribute on the npc, set the type to script, then you can activate it with the
do script. This will then allow you to restart the code that keeps the conversation going until you want it to end.
So time for some examples of how this actually looks put together
//whatever happens that starts the npc interraction
msg ("That was funny, right?")
msg ("")
do(NPC, "ConvoLoop")
/.........
//this is what goes in the ConvoLoop attribute of the npc
if (npc.tension = 0) {
msg("{command:1:1."Sure." ")}
msg("{command:2:2."Haha." ")
msg("{command:3:3."Where am I?" ")
get input {
if (npc.tension < 5){
//when tension reaches desired level for npc response, ignore player input and have npc continue the conversation
switch(result)
case (1) {
npc.tension = 1
do(NPC, "ConvoLoop")
}
case (2) {
if (npc.tension = 0)
//default response
else
do(NPC, "ConvoLoop")
}
case (3) {
do(NPC, "ConvoLoop"
}
}
else
//continue conversation from here after npc finally responds
}
This isn't by any means complete, more of an outline of how I would get the results your looking for, there will likely be quite a bit more too it depending on how you want the conversation to be able to play out, but hopefully this helps some. Important to note that in this script the tension timer never actually increases, that will have to be done separately depending on how you decide to control it.