Repeat/Conditionals/Set Variables are broken

Certain combinations of Repeat, Conditional, and Set/Increase variable blocks do not work correctly. The Player is not following the instructed flow and logic.

I probably spent 4 or 5 hours trying to nail this down, but in the end couldn’t find specific patterns. So I’m going to just give a bunch of examples.

In conjunction with the test code shown below, I used a simple frame counter & separate objects to show the variable values at the end of each frame as the code ran.

All of the code shown below can be found here. Change the custom rules in the Test Code object to the various test cases.

First test case. The result should have been 4 & 4. See commentary in the picture with the frame results for this one.

Two more examples where adding a wait fixed it. Both work similarly, but not exactly the same. These frame sequence are how I understand it’s supposed to work.

Now the wait is moved and it gets the right result but both Increase blocks are running during the same frame even though one is outside the conditional container. This would be fine, if everything else worked right. But wait for the next example…

Now the wait is in the same place but the conditional is changed. Both Increase blocks are still running during the same frame, but the conditional runs once when it’s not supposed to.

Last example. Added a Set block before the Repeat loop. The conditional should never run, but it does.

This needs to be fixed. Before I spent the hours troubleshooting this, I spent hours trying to figure out why a real project wasn’t working as expected. So I’m sure many other users are dealing with related problems and don’t even realize it. Worse yet, bugs like this give kids misconceived notions of how to code when they assume HS is doing what it’s supposed to.

Device: iPad7,11
iOS Version: 14.7.1
Hopscotch Version: 3.47.1
Player Version: 1.5.18


i agree
but i believe that even you don’t add this THT will take this under consideration and solve the bug in the next update


Hopefully :slightly_smiling_face:, but my intention was to make a case as to why fixing the bug(s) shouldn’t be overlooked. Businesses routinely have to make tough decisions as to how they spend their time & resources.


Thank you for creating this bug report! I have forwarded this to our dev team for further investigation and fixes.


That’s a big problem…


It is a pretty major issue when the execution of the code isn’t following the logic prescribed, as you mentioned.

Thank you for taking the time to isolate it and write it up to such a clear extent. I checked through your examples and confirmed that they aren’t executing as expected.


Strange, very strange indeed. Like you said (I think), adding a Wait block to the end of the repeat block does seem to work as a temporary fix


You know maybe somebody like the @moderators might help.


while that’s a good suggestion, leaders and moderators don’t have any control over the Hopscotch app. that’s why everyone makes topics like these! they help the hopscotch team see bug reports so that they can fix them!

this is interesting… i’m pretty sure i experienced this with one of my seed dev projects. it might explain some of the trouble i was having getting it to work. thanks for the examples!


O ok I never knew that either.


What? That makes no sense. It will probably be patched asap since it can make big problems.


yeah, thankfully using a wait block can fix it


What, talking to me?.


No I was replying to the topic.