temporally disable response timeout

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
joeylu
Posts: 110
Joined: Sun May 17, 2020 1:07 pm

temporally disable response timeout

Post by joeylu »

Hi Tony
I used to set response timeout 7 seconds in dialogue manager input section, and everything works fine
I have a request that to temporally disable the timeout for certain dialogue menus, I tried to use SetTimeout(x) sequence and it works fine
The problem is that once the SetTimeout() is called, it seems overwrite the default timeout (7 seconds), I have to manually SetTimeout(7) again to resume it back, this does not work well on a large based dialogues
Is there anyway in sequence or in script that I can temporally disable the response menu?

My idea (not yet implemented) is to write a custome sequence command, something like PauseTimeout(), then pause the timeout when sequence is called, and resume the timeout when menu is selected? If that is the right way to do, can you give me some examples in code? especially what namespace and method to use for Pause and Resume timeout?

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

Re: temporally disable response timeout

Post by Tony Li »

Hi,

You can add a script like this to the Dialogue Manager. It automatically resets the menu timeout to 7 seconds, although any specific dialogue entry's Sequence can override it just for the next menu by using SetTimeout(0). (This script will set it back to 7 after the menu.)

ResetMenuTimeout.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class ResetMenuTimeout : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        DialogueManager.conversationView.displaySettings.inputSettings.responseTimeout = 7;
    }
}
joeylu
Posts: 110
Joined: Sun May 17, 2020 1:07 pm

Re: temporally disable response timeout

Post by joeylu »

tks, will try
another related question, can I get the custom response timeout value from DialogueManager.instance?
Instead set it to static float 7, it would be better to get it dynamically
User avatar
Tony Li
Posts: 21021
Joined: Thu Jul 18, 2013 1:27 pm

Re: temporally disable response timeout

Post by Tony Li »

Yes. In a Start() method, record DialogueManager.displaySettings.inputSettings.responseTimeout.
Post Reply