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:
@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
I found a solution. Here's what I did, in case anyone in the future has the same question:
@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!
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 ;)
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?
You can do the option-Off thingy in the several options and use the if-statement you wrote in @S. Just add the command
if (....)
dDialog3.SetOptionState(4, eOptionOn);
This way the game starts the fourth option automatically after the first three are off.
Or simply
@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.
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.
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)