Extras Backtrack script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Extras Backtrack script

Post by Abelius »

Hi there,

I'm using the Backtracker script on the Extras page for debugging purposes (not actual gameplay), and I was wondering if it could be modified so it detects if the node is going to backtrack to will continue instantly and if that's the case, it also skips that one.

I ask this because I have a lot of entries whose sole purpose is to run sequencer commands and instantly continue, and when I push the Back button after one of those, I can't really 'jump' back over them.

Thanks.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Extras Backtrack script

Post by Tony Li »

What sequencer command(s) do you use to continue instantly?

We could add a "best effort" version of that, but it won't be able to catch every single possibility. For example, say you have a Lua variable named "duration" and a dialogue entry has this Sequence:

Code: Select all

Continue()@[var=duration]
If the "duration" variable is 0, it will continue instantly. But if "duration" is 5, it will wait 5 seconds. We can't know that ahead of time.
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Extras Backtrack script

Post by Abelius »

I think the vast majority of them are continued with a Continue(); command at the end of the sequence field.

And in the small number of cases that it has a duration, I'd just click the Back button again, no problem.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Extras Backtrack script

Post by Tony Li »

Change line 40 from this:

Code: Select all

while (!destination.subtitle.speakerInfo.IsNPC && stack.Count > 0)
to this:

Code: Select all

while ((!destination.subtitle.speakerInfo.IsNPC || destination.subtitle.sequence == "Continue()") && stack.Count > 0)
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Extras Backtrack script

Post by Abelius »

I've just modified the thing a bit:

while ((!destination.subtitle.speakerInfo.IsNPC || destination.subtitle.sequence.Contains("Continue();")) && stack.Count > 0)

Because I'm running more commands along Continue().

And this made me think that maybe I could use an alternative way to identify entries that should always be skipped back, so I've added another conditional so it also skips back if it encounters "//SkipBack" in the Sequence. That way I can cover more scenarios.

Thank you, Tony!
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Extras Backtrack script

Post by Tony Li »

Good ideas! Glad to help.
Post Reply