Code inside 7+ Check Once If Else’s won’t work (OPEN)

issue_open
#1

I was coding an art prompt generator that will randomly generate 31 art prompts, and none of them would be the same.
My code was basically:


When GENERATE is tapped
Set (Self: Prompt) to random 1 to 60


When (Self: Prompt) = 1

Check Once If (Text 3: Prompt) doesn’t equal 1

Check Once If (Text 2: Prompt) doesn’t equal 1
Set Text to “Aquamarine”
else
[do nothing]
end

else
[do nothing]
end

(Also by the way, there were 12 of those Check Once If Else’s in the code, all inside each other, with the Set Text in the middle of them, but that would make this post super long, so yeah.)


The Set Text inside all the Check Once If Else’s never happened in the project, even though I basically rigged the first rule so the value (Self: Prompt) would be set to 1 instead of a random number.

I did recreate the bug to make sure it wasn’t my code:


I used 2 objects in the recreation, with similar code to the prompt generator, but one object had 7 Check Once If Else’s, the other, 6. The second one’s (with 6 Check Once If Else’s) code worked, but the first one (with 7 Check Once If Else’s) didn’t.

9 Likes
#2

I deleted the seventh check once if in 1a and it had the same result.

Looking at the code, they have different check once ifs.

When go is pressed, 1a value will always be one, and the first check once if checks if it isn’t one.

And the rule which checks if it isn’t 1 runs when it is 1. Although if I fix that, it still doesn’t work.

Since I couldn’t find anywhere value of any object other than 1a is set to 1, I replaced them all with zero, replacing value of 1a with 10. In this case it still didn’t work.
Although, if I increase a counter by 1 in each check once if, then display the number in a repeat forever after them all, it shows 7. When I remove the variable blocks, it doesn’t work. When they are there and I replace set color with set text (though set color probably also works) it works fine, just much slower.

You can get it to work by moving set color into the sixth level of check once ifs, and changing the first conditional. Doing one of those by itself does not fix it though.

So this is half a bug in your code and half a bug in Hopscotch’s code.

8 Likes
#3

Did the same thing

4 Likes
#4

I concur that this is a bug with the player. @Ana @awesomeonion


Here’s a simpler example:

This doesn’t work for new projects (but existing projects with many more nested conditionals than this still work as expected)

With 6 or less conditionals, it works

7 Likes
#5

This will make it apply if it is anything lower or higher than 1. That’s probably the problem.

3 Likes
#6

But it’s supposed to apply. The value (Text 2: Prompt) doesn’t equal 1 in the code. (It equals 0.)

1 Like
#7

Weird bug. Thanks for reporting it as this can be quite irritating!

1 Like
#8

Then idk how to fix it. Maybe you should wait until the next update. THT can fix bugs when an update comes.