Skip to content

Fix trigger terminating sections influencing delay behavior#8518

Merged
APickledWalrus merged 4 commits intodev/featurefrom
patch/section-delay-behavior
Apr 1, 2026
Merged

Fix trigger terminating sections influencing delay behavior#8518
APickledWalrus merged 4 commits intodev/featurefrom
patch/section-delay-behavior

Conversation

@APickledWalrus
Copy link
Copy Markdown
Member

Problem

As described in #8203, when a section has a statement that cause a delay, that delay is propagates beyond the section even if the section is guaranteed to terminate execution (e.g. with a stop statement). This creates unexpected behavior as noted in the issue.

Solution

I've adjusted Section's loadCode method to consider the execution intent of the loaded section. If the loaded section results in execution terminating, then the delay state is set back to what it was before the section was loaded (i.e. the section has no effects on the delay state).

There were also a few issues with SecConditional I've resolved:

  • then blocks could be repeated multiple times
  • Two utility methods intending to look at the preceding conditionals in the chain incorrectly did so. They modeled the logic of the original method, but the circumstances are different so the logic is different. When these methods are called, the correctness of the chain has been verified, so they simply need to terminate when encountering the root IF conditional.

This problem is not fully resolved (for other cases). It does not consider exiting a number of sections. However, this is a more complex problem that may not be possible to solve given Skript's current design. The delay of the section would apply to upper sections, but not the immediate parent (or parents if exiting multiple). Skript does not currently have a way to handle this.

Testing Completed

Added a test for the expected delay behavior.
Added a test to SecConditional for then behavior.

Supporting Information


Completes:

Related: none
AI assistance: none

@APickledWalrus APickledWalrus added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Apr 1, 2026
@APickledWalrus APickledWalrus requested a review from a team as a code owner April 1, 2026 01:02
@APickledWalrus APickledWalrus added the 2.15 Targeting a 2.15.X version release. label Apr 1, 2026
@APickledWalrus APickledWalrus requested a review from a team as a code owner April 1, 2026 01:02
@APickledWalrus APickledWalrus requested review from Pesekjak and UnderscoreTud and removed request for a team April 1, 2026 01:02
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Apr 1, 2026
@APickledWalrus APickledWalrus moved this to In Review in 2.15 Releases Apr 1, 2026
@APickledWalrus APickledWalrus linked an issue Apr 1, 2026 that may be closed by this pull request
1 task
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.15 Releases Apr 1, 2026
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Apr 1, 2026
@APickledWalrus APickledWalrus merged commit 7e650c3 into dev/feature Apr 1, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.15 Releases Apr 1, 2026
@APickledWalrus APickledWalrus deleted the patch/section-delay-behavior branch April 1, 2026 20:29
@skriptlang-automation skriptlang-automation bot added completed The issue has been fully resolved and the change will be in the next Skript update. and removed feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.15 Targeting a 2.15.X version release. bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update.

Projects

Status: Done - Awaiting Release

Development

Successfully merging this pull request may close these issues.

Can't change the damage anymore after the event has already passed

3 participants