How do I make the "Continue" button complete dialogue first?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
AHAKuo
Posts: 8
Joined: Sat Dec 05, 2020 12:41 pm

How do I make the "Continue" button complete dialogue first?

Post by AHAKuo »

Hello there!

First of all, I love this engine. It is so awesome and it makes me able to tell so many cool stories! So thank you for that first :D


Now to my question:


I am using the continue function in the dialogue system, and have linked it to a game object which contains the button and a few UIKeyTriggers for it "E" and "Escape"

TL;DR It works ok, it continues the dialogue, but it skips it entirely. How do I make it finish the current dialogue and then continue? Is there a function for that? I want it to complete the dialogue typewriter effect and then when pressed again, go to next dialogue.

Thank you :D
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by Tony Li »

Hi,

The built-in dialogue UI prefabs, such as the Basic Standard Dialogue UI, are built that way.
  • Add a continue button to your dialogue UI.
  • Assign it to the subtitle panel's Continue Button field.
  • Add a Standard UI Continue Button Fast Forward component to the continue button.
  • Assign the subtitle text element to it.
  • Configure the Button component's OnClick() event to call StandardIUContinueButtonFastForward.OnFastForward.
AHAKuo
Posts: 8
Joined: Sat Dec 05, 2020 12:41 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by AHAKuo »

Yes! It works wonderfully now!

Although I did botch things up when I didn't notice that I had to reference the typewriter effect. But I did, and it works.

Thank you <3
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by Tony Li »

Happy to help!
User avatar
PayasoPrince
Posts: 104
Joined: Thu Jan 27, 2022 6:47 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by PayasoPrince »

Tony Li wrote: Sat Mar 06, 2021 6:42 pm Hi,

The built-in dialogue UI prefabs, such as the Basic Standard Dialogue UI, are built that way.
  • Add a continue button to your dialogue UI.
  • Assign it to the subtitle panel's Continue Button field.
  • Add a Standard UI Continue Button Fast Forward component to the continue button.
  • Assign the subtitle text element to it.
  • Configure the Button component's OnClick() event to call StandardIUContinueButtonFastForward.OnFastForward.
Hey, Tony.
Not sure if its frowned upon bumping old threads or not. I was using this ^ before. Now I am disabling my continue button. I still want to be able to fast forward the dialogue while the continue button is disabled.

Is this possible?
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by Tony Li »

If the continue button is disabled, how can you click it to fast forward?

You can set up something to do that; I'm just not sure exactly how you want it to work. With the standard setup, if the typewriter is playing then clicking the button will fast-forward it to the end. Now that the typewriter is at the end, the continue button should be active for continuing the conversation.

There's really just one line of code to fast forward a typewriter by calling its Stop() method, and another line of code to continue the conversation. If you want to implement some custom functionality, you could examine StandardUIContinueButtonFastForward.cs (the one in Scripts, not in Wrappers) and copy the lines of code you want to use.
User avatar
PayasoPrince
Posts: 104
Joined: Thu Jan 27, 2022 6:47 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by PayasoPrince »

Hi, Tony.

Thank you for the response! :D

Image

I want to keep this, but I ALSO want to be able to fast forward if the player presses a button.
Is there an easy way to accomplish this?
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by Tony Li »

By "press a button" do you mean a UI button onscreen or an input button (e.g., keyboard or joystick button)?

If you mean a UI button, you could add another button that stops the typewriter effect. You can hook up its OnClick() event to the typewriter's Stop() method.

If you mean an input button, you can add a script to the subtitle panel that listens for the input and calls the typewriter's Stop() method. Or, if you don't want to do any scripting, you can create a UI button but make it invisible (e.g., zero width and height) whose OnClick() event calls the typewriter's Stop() method. Add a UI Button Key Trigger component to it, and specify the key code or input definition that you want to map to the button as a hotkey. When the player presses this hotkey, it will simulate a button click.

I've finished work for the night. If you have any follow-up questions, let me know and I'll reply in the morning.
User avatar
PayasoPrince
Posts: 104
Joined: Thu Jan 27, 2022 6:47 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by PayasoPrince »

I ended up adding another UI Button for fast forward and made it invisible by giving it a width & height of 0.
Seems to work exactly how I wanted it to. Thanks Tony! :D
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I make the "Continue" button complete dialogue first?

Post by Tony Li »

Glad to help!
Post Reply