Using a variable in an ability makes the ability take a frame too long

If you use a variable in an ability, the ability will take a frame longer than it should to execute.

If you remove the variable in the custom block it only takes 1 frame. With the variable in, it should execute on the same frame as the wait block, but it doesn’t seem to. (or an extra frame is added somewhere)

Having just 1 variable block is enough to have this effect, multiple variable blocks are the same as just 1. Also, when the ability is only variable blocks, it still takes 2 frames.

15 Likes

It might be placing the extra frame on the exiting of the custom block, but even then it was still 2 frames even without the wait block. Strange…

6 Likes

Oh, this is an interesting discovery! This is something that would be great if it was fixed, it’s a small thing but it can be big enough to cause trouble or unexpected behavior if you’re working with or relying on frames in your project.

3 Likes

It would be nice if some sort of change would happen with this. I had code which looped through a list and checked something with each item. I used custom blocks to get items from the list. When I removed the variable blocks from the abilities, it got noticeably faster. Since I removed 2 frames per custom block, I had 4 custom blocks, and it ran through this code 6 times, I saved 48 frames where I did not change anything in the screen. Normally these frames being used wouldn’t really matter, but since it was in the main control the player has, you couldn’t actually do anything during them so this change (which sped it up by almost a second in the worst case) is actually noticeable. It would be nice if I could have kept the readable code and still have a game that is not really slow to play.

3 Likes