Page 1 of 1

[Klonan] [1.1.59] Ungraceful error associated with jump_to_cutscene_waypoint out-of-bounds

Posted: Mon May 30, 2022 8:49 am
by Honktown
Reasoning:
I wanted to pcall(player.jump_to_cutscene_waypoint, event.waypoint_index + 1) during on_cutscene_waypoint_reached, to test if the waypoint just reached was the final (within reason). Was in the middle of testing what was true (are we still in cutscene controller, what gets raised, etc) and ran into a side-effect.

Logically speaking, either the waypoint is set to it's current value (doing nothing, maybe raising reached event which would be avoided the second time) or an error is raised: index out of bounds, meaning the last waypoint just ended the cutscene.

Expectation: Error is raised without side-effects.
Reality: Error with side effect of raising on_cutscene_waypoint_reached only when omitting a final_transition_time

Reproduction:
0) listen to reached event and set an incremented index

1) Create a set_controller argument table with some waypoints.
2) omit a final_transition_time
3) set_controller(cutscene)

Game repeatedly raises waypoint reached with higher indices, never leaving the cutscene.
If final_transition_time is present* [edit], there is no side-effect.

Code is provided:
cutscenes.lua
(1.56 KiB) Downloaded 67 times
I understand the nature of this is "there's a side effect from *an error*, could you fix the side effect?", but it is a strange incident that I thought someone might want to know about.
waypoint_spam.jpg
waypoint_spam.jpg (505.28 KiB) Viewed 1053 times

Re: [Klonan] [1.1.59] Ungraceful error associated with jump_to_cutscene_waypoint out-of-bounds

Posted: Mon May 30, 2022 10:21 am
by Klonan
Its not really a side effect of an error, just a bug, that if you set the index to the last index when you have no final transtion time, it would fail its 'Am I finished check' and loop forever.

I fixed it for 1.2