Page 1 of 1

Extras Backtrack script

Posted: Thu Feb 22, 2024 6:38 am
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.

Re: Extras Backtrack script

Posted: Thu Feb 22, 2024 8:36 am
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.

Re: Extras Backtrack script

Posted: Thu Feb 22, 2024 9:19 am
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.

Re: Extras Backtrack script

Posted: Thu Feb 22, 2024 10:52 am
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)

Re: Extras Backtrack script

Posted: Thu Feb 22, 2024 11:44 am
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!

Re: Extras Backtrack script

Posted: Thu Feb 22, 2024 2:56 pm
by Tony Li
Good ideas! Glad to help.