custom ResponseTimeoutAction toward a hidden menu text

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

custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

Hi, I'm trying to create some scenarios like, whenever the current choice menu (dialogue entry) is timeout, it will link to a hidden menu (dialogue entry) that is not visible to the menu selection, and that hidden menu links to its own children branch.

I'm able to build a custom responseTimeoutAction handler and it works well, but I'm struggling to add a hidden menu and point the timeout action toward it, am I missing any settings in the editor conversations?

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

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by Tony Li »

Hi,

That needs to be done mostly in code. In your timeout handler, you can tell the conversation to go to a specific dialogue entry. Roughly:

Code: Select all

ConversationState state = DialogueManager.conversationModel.GetState(someDialogueEntry);
DialogueManager.conversationController.GotoState(state);
The catch it that you need to specify "someDialogueEntry".

You could set one of the dialogue entries' Conditions field to "false" so it will never appear in the response menu:

customTimeout.png
customTimeout.png (41.04 KiB) Viewed 1537 times

If you define a custom field -- for example, "ForTimeout" -- then in your timeout handler you can check all of the current conversation state's outgoing links for an entry whose "ForTimeout" field is true:

Code: Select all

foreach (var link in DialogueManager.currentConversationState.subtitle.dialogueEntry.outgoingLinks)
{
    var responseEntry = DialogueManager.MasterDatabase.GetDialogueEntry(link);
    if (Field.LookupBool(responseEntry.fields, "ForTimeout") == true)
    {
        state = DialogueManager.conversationModel.GetState(responseEntry);
        DialogueManager.conversationController.GotoState(state);
        break;
    }
}
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

Thank you so much Tony, that is exactly what I was looking for! btw, great asset!

one more question that's kinda related to the previous one.

Let's say I got the hidden dialogue entry works, and now I have two menu text
(1 visible and 1 hidden)

my question is that normally I always untick the "Always force response menu" in the dialogue manager, so when there's only one choice the menu won't appear.
this works fine when there's no hidden dialogue entry

however, when I added the hidden dialogue entry by setting its condition to false, I'm actually expecting the menu will appear even there's only one visible entry
currently, the dialogue system will simply ignore the hidden entry and play the next entry based automatically based on the visible entry

any ideas? tks
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by Tony Li »

Try adding "[f]" (without quotes) to the visible entry's text. This tells the Dialogue System to [f]orce it to appear as a menu.
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

works perfectly! thank you tony
just curious, where can I find all these [] parameters, I might just missed it from the document :(
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by Tony Li »

Hi,

The Dialogue System calls them markup tags. You can find them here: Markup Tags
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

Hi, not sure if it was my code or the update, but I don't remember that I have edit anything relates to the following issue.

I set the dialogue system controller > Input setting > Response timeout to 7 and the response timeout action to "custom".
It was working perfectly prior I upgraded to 2.2.7. My bubble menu stays for 7 seconds
After the upgrade, now it ignores the setting and will fades away in exactly 3 second. I put a debug in the StandardUITimer.StartCountdown, the parameter duration is 3 no matter what's my custom timeout setting
any idea? tks
User avatar
Tony Li
Posts: 21049
Joined: Thu Jul 18, 2013 1:27 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by Tony Li »

Is it possible that you customized something in a Dialogue System script, and it got overwritten by importing version 2.2.7?

If you're using version control, you could look through your revision history to see if you changed any Dialogue System files.

If you find that you need to reapply a customization, let me know. I'll add a C# event or virtual method that you can override, or something like that, so you don't have to actually touch the Dialogue System file.
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

Hi Tony, tks for the reply
No I never custom write anything directly to the dialogue system scripts. I used to add extended classes based on your scripts, and saved them to my custom script folder. Something like StandardUITimerExt to extend StandardUITimer.
The strange thing is that I only have 5 small extend scripts and none of them modifying anything to the timeout duration.
And it was working yesterday before I upgrade to 2.2.7 :(
So I'm wondering that if there are any classes or anywhere in dialoague system prefab inspectors that can possibly overwrite the "response timeout" field? so I can do more deep debuggings, tks
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: custom ResponseTimeoutAction toward a hidden menu text

Post by joeylu »

ok, found the error, somehow in one dialogue entry, from the very beginning of the conversation, I put the SetTimeout(3) in the sequence. it actually overrides the global response timeout duration.
Maybe it's just me but I thought the dialogue entry sequence settings will only affect its own dialogue entry, not to overwrite the global. Otherwise, after setup a custom timeout, I have to reset it back the global value, this makes the "response timeout" setting in dialogue controller very usable. Or am I doing anything wrong, lol
Last edited by joeylu on Thu Jun 11, 2020 1:02 pm, edited 1 time in total.
Post Reply