Dialogue Progression Help [How to wait till next turn to read input?]

ok guys I’m off to bed but I’m a little stuck and i hope someone can help

essentially i have made the Whackest longest way to lay out a dialogue ever but it (sort of) works for me and especially works for what i want it for (i know theres extensions for dialogue but I REALLY wanna challenge myself to mostly write this game) but i will not refuse help

I have made a system where as a dialogue progresses a variable called
InEncConversation changes value from

0 (Out of Dialogue with the npc including when said goodbye to)
1 (First phase of conversation with the npc)
2 (1st variant of Second Phase of Dialogue)
3 (2nd variant of Second Phase of Dialogue)
4 (3rd variant of Second Phase of Dialogue)
5 (1st variant of Third Phase of Dialogue)
and so on

etc etc… (it keeps track of which response you have gotten and what to look out for in your input)

there is also a variable called Met Enchantress which is simply if you’ve been introduced or not (1 or 0)

now here is the first phase of Dialogue ((when you have not yet previously met her))

Instead of talking the Elegant Lady for the first time:
	now Met Enchantress is 1; [YOU HAVE BEEN INTRODUCED TO THE LADY]
	now InEncConversation is 1; [CHAT IS IN PROGRESS IN 1ST PHASE]
	now the Elegant Lady is proper-named;
	now the description of the Elegant Lady is "Lydia stands in the field staring off into the Aether sky peacefully.";
	say "[the elegant lady] : Behold, child. I am Lydia, enchantress of Aragain and wanderer of the Aetherial realm. Few mortals make it to the place in which your feet now tread, and yet fate has led you here. I mean you no harm, though I cannot help but to harbor a certain caution in your prescence... [paragraph break] The Woman's eyes shine with an ancient wisdom..";
	now the printed name of  the elegant lady is "Lydia, The Enchantress";
	sort the table of sorted random enc sounds in random order;
	choose a row with currentencmotif of questioning in the table of sorted random enc sounds;
	play currentencsound entry on midground;
	say "[paragraph break] [Bold type] What would you like to say?.[line break][line break] 1: What is this place?[line break] 2: How did you get here?[line break] 3: Ask about...[line break] 4: Goodbye..."; [ RESPONSES]

this so far works lovely
and after has prompted you nicely with some responses:

this next section of code just tells the game not to print silly irrelevant messages in return of the potential responses ahead.

Understand the commands “1” and “2” and “3” and “4” as something new.
Understand “1” or “2” or “3” or “4” as a mistake.
Understand the commands “What” and “How” and “Goodbye” as something new.
Understand “What [text]” or “How [text]” or “Goodbye [text]” as a mistake.
Understand the commands “Ethereal” and “Anyone” as something new.
Understand “Ethereal [text]” or “Anyone [text]” as a mistake.
Understand the commands “ask” and “tell” and “say” and “answer” as something new.
Understand “ask [text]” or “tell [text]” or “answer [text]” or “say [text]” as a mistake

now my next section of code defines what the player can input in response to this situation, it depicts that now that the InEncConversation has moved to 1, these inputs are valid as choices to move the dialogue on (this one is a little long)

[FIRST PORTION OF THE CHAT]
After reading a command when InEncConversation is 1:
	if EnchantressDisgusted is not 1:
		if the player's command includes "1":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of neutral in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You ask: 'What is this place?'";
			say "[the elegant lady]: INSERT LYDIAS EXPLANATION OF THE AETHER HERE [paragraph break][bold type]  1: Ethereal Plains?[line break] 2: Anyone else here?[line break] 3: Goodbye...";
			now InEncConversation is 2; [QUESTIONS 1-1]
		otherwise if the player's command includes "What":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of neutral in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You ask: 'What is this place?'";
			say "INSERT LYDIAS EXPLANATION OF THE AETHER HERE [paragraph break][bold type]1: Ethereal Plains?[line break] 2: Anyone else here?[line break] 3: Goodbye...";
			now InEncConversation is 2; [QUESTIONS 1-1]
		otherwise if the player's command includes "2":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of sad in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You ask: 'How did you get here?'";
			now InEncConversation is 3; [QUESTIONS 2-1]
			say "INSERT LYDIAS EXPLANATION OF HOW SHE ARRIVED HERE [paragraph break][bold type] INSERT RESPONSE OPTIONS HERE";
		otherwise if the player's command includes "How":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of sad in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You ask: 'How did you get here?'";
			now InEncConversation is 3; [QUESTIONS 2-1]
			say "INSERT LYDIAS EXPLANATION OF HOW SHE ARRIVED HERE [paragraph break][bold type] INSERT RESPONSE OPTIONS HERE";
		otherwise if the player's command includes "3":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of questioning in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "...";
			say "[bold type]What would you like to ask about? [paragraph break][bold type] INSERT TOPICS TO ASK ABOUT HERE";
			now InEncConversation is 4; [ASK ABOUT]
		otherwise if the player's command includes "Ask":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of questioning in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "...";
			say "[bold type]What would you like to ask about? [paragraph break][bold type] INSERT TOPICS TO ASK ABOUT HERE";
			now InEncConversation is 4; [ASK ABOUT]
		otherwise if the player's command includes "4":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of agreeable in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You politely walk away from the conversation.";
			try looking;
			now InEncConversation is 0; [LEFT CONVERSATION]
		otherwise if the player's command includes "Goodbye":
			sort the table of sorted random enc sounds in random order;[Sound]
			choose a row with currentencmotif of agreeable in the table of sorted random enc sounds;[Sound]
			play currentencsound entry on midground; [Sound]
			say "You politely walk away from the conversation.";
			try looking;
			now InEncConversation is 0; [LEFT CONVERSATION]
		otherwise:
			say "The Enchantress looks at you with a raised eyebrow. [line break] [the elegant lady]: I'm sorry child, communication isn't so fluid here the Aether. [Line break] [Bold Type] Try using one of the number prompts to proceed with dialogue.";

these are the numbers as well as the first words of each reponse given before, moving the dialogue along, and currently in the Case of responding “1” or “What is this place?” giving MORE options to respond with, ensuring to move the Dialogue along with InEncConversation now being set to 2.

the next piece of code requires that InEncConversation be 2 when reading for player input. affirming the player had successfully moved on from the last dialogue by selecting the first option of dialogue from earlier

[QUESTION 1-1]
After reading a command when InEncConversation is 2:
	if inEncConversation is not 1:
		if EnchantressDisgusted is not 1:
			if the player's command includes "1":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of enthused in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You ask Lydia about the Ethereal plains.'";
				now InEncConversation is 5; [QUESTIONS 1-2]
				say "INSERT LYDIAS EXPLANATION OF ETHEREAL PLAINS HERE [paragraph break][bold type] INSERT DIALOGUE OPTIONS HERE";
			otherwise if the player's command includes "Ethereal":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of enthused in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You ask Lydia about the Ethereal plains.";
				now InEncConversation is 5; [QUESTIONS 1-2]
				say "INSERT LYDIAS EXPLANATION OF ETHEREAL PLAINS HERE [paragraph break][bold type] INSERT DIALOGUE OPTIONS HERE";
			otherwise if the player's command includes "2":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of questioning in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You ask Lydia if there are others here in the Aether.";
				now InEncConversation is 6; [QUESTIONS 1-3]
				say "INSERT LYDIAS EXPLANATION OF OTHERS IN THE PLAINS [paragraph break][bold type] INSERT DIALOGUE OPTIONS HERE";
			otherwise if the player's command includes "Anyone":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of questioning in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You ask Lydia if there are others here in the Aether.";
				now InEncConversation is 6; [QUESTIONS 1-3]
				say "INSERT LYDIAS EXPLANATION OF OTHERS IN THE PLAINS [paragraph break][bold type] INSERT DIALOGUE OPTIONS HERE";
			otherwise if the player's command includes "3":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of agreeable in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You politely walk away from the conversation.";
				try looking;
				now InEncConversation is 0; [LEFT CONVERSATION]
			otherwise if the player's command includes "Goodbye":
				sort the table of sorted random enc sounds in random order;[Sound]
				choose a row with currentencmotif of agreeable in the table of sorted random enc sounds;[Sound]
				play currentencsound entry on midground; [Sound]
				say "You politely walk away from the conversation.";
				try looking;
				now InEncConversation is 0; [LEFT CONVERSATION]
			otherwise:
				say "The Enchantress looks at you with a raised eyebrow. [line break] [the elegant lady]: I'm sorry child, communication isn't so fluid here the Aether. [Line break] [Bold Type] Try using one of the number prompts to proceed with dialogue.";		

My issue comes into play when the script is not waiting for InEncConversation to move onto 2 before reading the input of 1 from the answer before: thus answering twice and ruining the layout:

image

someone please assist me with identifying how i can ensure if the player responds 1 it will not respond 1 to the next phase of dialogue also on that same turn

thank you so much to anyone who can help

noting there is some missing script from this full set up but i believe this logic piece is the part i need to fix… involving reading for players input when InEncConversation is [value]

Here’s my guess:

  1. The game checks if InEncConversation is 1. It is!
  2. It executes code.
  3. It changes InEncConversation to 2.
  4. The game checks if InEncConversation is 2. It is!
    etc.

You need to get it to stop in the middle. There are two ways I can think of that might work:

  1. Add ‘reject the player’s command’ at the end of the ‘after reading the player’s command’ block of code. That should stop the action processing.
  2. Make one big ‘After reading a command when InEncConversation > 0’ using ‘if’ and ‘otherwise’ if so that both commands won’t run.

There are probably other ways to fix it as well, but right now those are my best guesses.

4 Likes

Always saving me a lot of confusion thank you @mathbrush ill let you know when i apply these and lyk which worked!

1 Like

perfectly functioning thank you so much!

2 Likes

You might want to look into

Include Questions by Michael Callaghan.

He has question/answer dialog all worked out and probably will simplify your code.