Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shamz on Wed 01/03/2017 18:05:55

Title: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: shamz on Wed 01/03/2017 18:05:55
In a dialog, I have three options that turn off after the player selects them. After the player selects the last one, AGS "returns" to an empty dialog and crashes.

Is there a way I can continue the dialog after all option states have been turned off?

Here's what I'm trying:
Code (ags) Select

@S

cA: I have three things I want to say.
cB: In what order do you want to say them?

return
@1:
cA: Option 1.
cB: Okay.
option-off 1
return

@2:
cA: Option 2.
cB: I hear you.
option-off 2
return

@3:
cA: Option 3.
cB: Gotcha.
option-off 3
return

goto-dialog 2 // this doesn't work since the script doesn't run past the returns
Title: Re: How do I exhaust all dialog options before continuing the conversation?
Post by: shamz on Wed 01/03/2017 18:22:25
I found a solution. Here's what I did, in case anyone in the future has the same question:

Code (ags) Select

@S

cA: I have three things I want to say.
cB: In what order do you want to say them?

return
@1:
cA: Option 1.
cB: Okay.
option-off 1
  if ((dThisDialog.GetOptionState(2) != eOptionOn) && (dThisDialog.GetOptionState(3) != eOptionOn)) {
    dNextDialog.Start();
  }
return

@2:
cA: Option 2.
cB: I hear you.
option-off 2
  if ((dThisDialog.GetOptionState(1) != eOptionOn) && (dThisDialog.GetOptionState(3) != eOptionOn)) {
    dNextDialog.Start();
  }
return

@3:
cA: Option 3.
cB: Gotcha.
option-off 3
  if ((dThisDialog.GetOptionState(2) != eOptionOn) && (dThisDialog.GetOptionState(1) != eOptionOn)) {
    dNextDialog.Start();
  }
return


If anyone has a better solution please share!
Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: Kumpel on Wed 01/03/2017 18:51:05
You could shorten the whole thing if you add a hidden 4th option which is activated in the "@S area" (checked every time you do return) and starts autmatically if all three other options are off. And in this option you add the dialog change. But your version works too, thus it's all right ;)
Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: shamz on Thu 02/03/2017 07:07:10
Hi Kumpel! Your way sounds much easier :grin:

Quote from: Kumpel on Wed 01/03/2017 18:51:05
activated in the "@S area" (checked every time you do return) and starts autmatically if all three other options are off.

I'm not sure how to activate in the @s area though. How do I turn on the option only when all three options are off?
Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: Kumpel on Fri 03/03/2017 13:40:38
You can do the option-Off thingy in the several options and use the if-statement you wrote in @S. Just add the command

Code (ags) Select

if (....)
  dDialog3.SetOptionState(4, eOptionOn);


This way the game starts the fourth option automatically after the first three are off.

Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: Cassiebsg on Fri 03/03/2017 16:20:29
Or simply
Code (ags) Select

@S
cA: I have three things I want to say.
cB: In what order do you want to say them?
   if (....)
   {
option-on 4
   }
return


You can probably discard the brackets {}, since it's a one liner, but I usually like to add them, even if it's just one line when the code is in another line.
Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: Kumpel on Sat 04/03/2017 13:45:34
Cassie are you sure about that? I thought you can't mix ags code with ags dialog script commands? In my experience you definitely couldn't do it like that in earlier versions.
Title: Re: How do I exhaust all dialog options before continuing the conversation? [SOLVED]
Post by: Cassiebsg on Sat 04/03/2017 14:34:03
I always do it like that, and it works. Just make sure the script code, including brackets is indented and the dialog command isn't. (nod)