Skip to content

move addDelayedEvent to trigger after the delay finishes#8299

Merged
sovdeeth merged 1 commit intoSkriptLang:dev/patchfrom
sovdeeth:patch/delay-band-aid-fix
Dec 1, 2025
Merged

move addDelayedEvent to trigger after the delay finishes#8299
sovdeeth merged 1 commit intoSkriptLang:dev/patchfrom
sovdeeth:patch/delay-band-aid-fix

Conversation

@sovdeeth
Copy link
Member

Problem

Delays would trigger isDelayed as soon as they scheduled the delayed task, rather than when the delayed task begins. Since isDelayed cannot differentiate between Triggers, this meant that one trigger could schedule a delay and a second, undelayed, trigger would think it was delayed too!

on jump:
  send isDelayed # sends false
  wait 1 tick # adds to DELAYED
  send isDelayed # sends true

on jump:
  send isDelayed # uh oh, this ran after the first event, so the event's already in DELAYED! returns TRUE
  wait 1 tick
  send isDelayed # sends true

This PR does NOT fix this issue! It simply mitigates the issue so that the user isn't impacted by it. The delay api still needs to be updated when proper runtime context is implemented.

Solution

Moving the addDelayedEvent call to after the delay is complete ensures that non-delayed code can run as normal, but still ensures delayed code is ran as delayed code. I believe this is safe, but if anyone can think up a counterexample please comment it.

Testing Completed

Manual testing confirms this functions properly, but I did not do a comprehensive check of behaviors. Automated tests can't handle delays so this can't be tested automatically.

Supporting Information


Completes: none
Related: #8298

@sovdeeth sovdeeth added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Nov 25, 2025
@sovdeeth sovdeeth requested a review from a team as a code owner November 25, 2025 02:52
@sovdeeth sovdeeth requested review from Burbulinis and erenkarakal and removed request for a team November 25, 2025 02:52
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Nov 25, 2025
@sovdeeth sovdeeth changed the title move addDelayedEvent to trigger after the delay finishes, rather than… move addDelayedEvent to trigger after the delay finishes Nov 25, 2025
@sovdeeth sovdeeth moved this to In Review in 2.13 Releases Dec 1, 2025
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.13 Releases Dec 1, 2025
@skriptlang-automation skriptlang-automation bot added patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. and removed needs reviews A PR that needs additional reviews labels Dec 1, 2025
@sovdeeth sovdeeth merged commit 72dcc95 into SkriptLang:dev/patch Dec 1, 2025
5 checks passed
@skriptlang-automation skriptlang-automation bot added the completed The issue has been fully resolved and the change will be in the next Skript update. label Dec 1, 2025
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.13 Releases Dec 1, 2025
@skriptlang-automation skriptlang-automation bot removed the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Dec 1, 2025
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.13 Releases Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

No open projects
Status: Done - Released

Development

Successfully merging this pull request may close these issues.

3 participants

Comments