Testing and validating non syntax part of sequences

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Swing Wren
Posts: 31
Joined: Fri Apr 10, 2020 2:30 am

Testing and validating non syntax part of sequences

Post by Swing Wren »

Hello, I'm quite new to the dialogue system and I was trying to figure out what are the best approaches on validating the non syntax part of the sequences. I have different custom sequence commands that I wanted to validate if they have the correct values inserted into them.

What would be the most idiomatic approach to do this? my first thought would be parse in tests the sequences of each command and validate them but I don't know if this is usually done with the dialogue system.

Also I would like to know if it would be possible to extend the Point-and-Click Sequencer Wizard.

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

Re: Testing and validating non syntax part of sequences

Post by Tony Li »

Hi,
Swing Wren wrote: Fri Apr 10, 2020 3:09 amHello, I'm quite new to the dialogue system and I was trying to figure out what are the best approaches on validating the non syntax part of the sequences. I have different custom sequence commands that I wanted to validate if they have the correct values inserted into them.

What would be the most idiomatic approach to do this? my first thought would be parse in tests the sequences of each command and validate them but I don't know if this is usually done with the dialogue system.
Yes, you can do that. It depends on what kind of validation you want to do. Since a lot of values can vary at runtime, you might want to do the validation at runtime. Or you can write an editor script to go through your dialogue database and validate each dialogue entry's sequence at design time instead. Roughly something like:

Code: Select all

var parser = new SequenceParser();
foreach (var conversation in myDatabase.conversation)
{
    foreach (var entry in conversation.dialogueEntries)
    {
        var sequence = entry.sequence;
        if (string.IsNullOrEmpty(sequence) continue;
        var commands = parser.Parse(sequence);
        if (commands == null || commands.Count == 0)
        {
            // Unable to parse:
            Debug.LogWarning("Sequence syntax is invalid: " + sequence);
        }
        else
        {
            // Can parse. Now need to interpret to arguments passed to each sequencer command:
            foreach (var command in commands)
            {
                // Check command.parameters[] array however you want.
                // Possible check command.messageToWaitFor and endMessage.
            }
        }
    }
}
Remember to validate the Dialogue Manager's Camera & Cutscene Settings > Default Sequence and Default Player Sequence, too.

This kind of validation can get tricky, though, if you use some of the more complex features of sequences, such as variable replacement, since you don't know ahead of time what those variable values may be.
Swing Wren wrote: Fri Apr 10, 2020 3:09 amAlso I would like to know if it would be possible to extend the Point-and-Click Sequencer Wizard.
If you write a custom sequencer command, it will appear in the "+" > All Sequencer Commands submenu. There aren't provisions for much more customization without actually editing the Dialogue System's editor source code.
Swing Wren
Posts: 31
Joined: Fri Apr 10, 2020 2:30 am

Re: Testing and validating non syntax part of sequences

Post by Swing Wren »

Thanks! I'll see what I can come up with
Post Reply