Auto Play and Skip All buttons

Announcements, support questions, and discussion for the Dialogue System.
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Thanks Tony, I just noticed that whenever I interact with Skip All or Auto Play buttons (doesn't matter if they are turned on or off, simply using these buttons seem to do it), the dialogue continues normally, but sequences don't play. I have attached a video where you can see a comparison, in the first case I interact with Skip All and my sequence where the NPC moves doesn't play, and in the second where I don't click on Skip All, the sequence plays like it should.

User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Auto Play shouldn't affect sequences since it just sets the continue mode to Never, but Skip All definitely will.

There are two ways to handle that. If all of your sequencer commands can run immediately, instead of over time, you can change the ConversationControl script's OnConversationLine method to:

Code: Select all

    void OnConversationLine(Subtitle subtitle)
    {
        if (skipAll)
        {
            subtitle.sequence = "Continue(); " + subtitle.sequence;
        }
    }
Make sure commands that must run have 'required' in front of them, or change the line in the method above to something like:

Code: Select all

subtitle.sequence = "Continue()@0.01; " + subtitle.sequence;
to give them a frame to run.

But if sequences play over time -- e.g., MoveTo(Stairs,,3) or AnimatorPlayWait(Dance) -- you'll need to handle it differently since you won't really be skipping. The easiest may be to add a 'required' command that plays at the end to make sure things are in the right state. For example, change this:

Code: Select all

MoveTo(Stairs,,3); // Move speaker to stairs over 3 seconds
to:

Code: Select all

MoveTo(Stairs,,3); // Move speaker to Stairs over 3 seconds
required MoveTo(Stairs)@3; // At the 3-second mark (or earlier if skipping), snap speaker to Stairs
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Understood,

Code: Select all

subtitle.sequence = "Continue()@0.01; " + subtitle.sequence;
worked :)
While we are here, can you tell me why do I have to click continue two times here to end the dialogue?



My Continue button is set to always here, if I have it set to Optional, everything works normally, after PC line, the dialogue ends and closes without having to click on continue twice. Attached a picture of my current dialogue setup
Attachments
Screenshot_3.png
Screenshot_3.png (13.08 KiB) Viewed 1162 times
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

Hi,

I don't know. It looks like the typewriter is done typing. If the typewriter were still going, the first click would generally fast-forward the typewriter, and the second click would advance the conversation. But that doesn't look to be the case here.

I see the final <End> node has a Sequence. What's the Sequence?

If you temporarily set the Dialogue Manager's Debug Level to Info and reproduce the issue, does the Console window shed any light on the issue?
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

This is what my sequencer does:

Code: Select all

public class SequencerCommandAudreyMove : SequencerCommand
    { 

        public void Awake()
        {
      

            GameObject directressObj = GameObject.Find("Audrey");
            DirectressMovement dirMove = directressObj.GetComponent<DirectressMovement>();
            dirMove.Move();

            print("MOVING EVENT PLAYED");

            Stop();
        }

    }
Attached image of how the info debug looks in this case.
Attachments
Screenshot_2.png
Screenshot_2.png (36.67 KiB) Viewed 1156 times
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

I don't know. Feel free to send a reproduction project to tony (at) pixelcrushers.com.

Or you could try adding a Continue() to the last node's Sequence. If SequencerCommandAudreyMove waits until Audrey has finished moving before calling Stop(), you could do something like:

Code: Select all

AudreyMove()->Message(Moved);
Continue()@Message(Moved)
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Adding Continue() to the last node Sequence worked! Thank you Tony :D
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Another question, is there any stored reference to the Dialogue System Trigger that called the ongoing dialogue? Because I want to reenable the Dialogue System Trigger when the player answers something like "Not now, we can continue later." I know I could make a sequencer for each Dialogue System Trigger but it would be very handy if instead of having a different sequencer for each trigger, I had a universal sequencer like this: (Pseudocode)

Code: Select all

SequencerCommandReenableTrigger: SequencerCommand

	void Awake() 
	{
		 DialogueManager.LastInteractedDialogueSystemTrigger.enabled = true;
		 Stop();
	}
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Auto Play and Skip All buttons

Post by Tony Li »

mac wrote: Sat Apr 24, 2021 9:49 pmAnother question, is there any stored reference to the Dialogue System Trigger that called the ongoing dialogue?
No, but you can make a subclass of DialogueSystemTrigger that stores a reference. Example:

Code: Select all

public class CustomDialogueSystemTrigger : DialogueSystemTrigger
{
    public static DialogueSystemTrigger LastInteractedDialogueSystemTrigger = null;
    
    protected override void DoConversationAction(Transform actor)
    {
        LastInteractedDialogueSystemTrigger = this;
        base.DoConversationAction(actor);
    }
}
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: Auto Play and Skip All buttons

Post by mac »

Alright, but how do I get this stored reference now?

The sequencer I'm trying is not working

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

namespace PixelCrushers.DialogueSystem.SequencerCommands
{

    public class SequencerCommandReenableDialogue : SequencerCommand
    { 

        public void Awake()
        {

            DialogueSystemTrigger dialogueTrigger = FindObjectOfType<DialogueSystemTrigger>();
            dialogueTrigger.LastInteractedSystemTrigger.enabled = true; //Missing reference (LastInteractedSystemTrigger)

            Stop();
        }

    }

}
Post Reply