@Yuanyuan
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