Timing bug when using abilities with >1 instant blocks

1 sentence description of the problem: Code like this:


which uses multiple instant blocks inside of a custom block as the only code in a rule
does not change the value of a at the correct time.

Steps to reproduce the problem every time:
(Start in a blank draft if possible)

  1. Add a rule that sets a variable to some value
  2. Add a rule when that variable = the value you set, run a custom block that contains more than one instant block such as set variable, with one of the last ones changing the value of the first variable
  3. Add a new rule with the same condition.
    …

I expected this to happen: The third rule to never be run since the second one makes its condition false before it is checked.

But instead this happened: The third rule does in fact run.

Screenshots/video: https://c.gethopscotch.com/p/12y4p0q7xv


Player 2.2.0

8 Likes

When testing, this seems to happen when the instant blocks are in any order.

It might be related to the fact that any container with 2 or more instant blocks (including comments, even though they are ignored in code, and thus shouldn’t be causing the timing of the code to change) will cause the rule to run at 30 times/sec instead of the usual 60 times/sec.

But it also happens when the first rule is set to When Game Starts, so it’s not just a coincidence.

4 Likes

THT might not be able to fix this fully (because in order to do that, they’d have to find a way to make rules with containers with >1 instant block run at 60 times/sec like it did in player 1.5.x, which is very risky), but they’ll at least be able to fix it in the case a user uses When Game Starts for the first rule.

1 Like

(@t1_hopscotch) Probably due to how the containers are framed now, but it doesn’t seem to be fast enough in scenarios where there are a chain of rules running on the same frame.

The value set in the first block of a container is seen by the rule(s) below on the same frame, but not the ones after, for some reason…

I ran two tests, both with an input of 1681691896099 (timestamp for 4-17-2023, 0:38:16 GMT)

All of the code is the same, and the only thing added/removed was the wait block.

With wait 0 before set text:

Without

Project link: Fast Timestamp to Date+Time by Crosbyman64

Mostly related to this bug: Timing bug when using abilities with >1 instant blocks, but it happens to me with normal containers as well…

2 Likes

I just quickly moved it here as well since it was on a related topic, but will note that it happens with regular containers as well and not just abilities

2 Likes