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

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.

10 Likes

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

Did the same thing

4 Likes

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

8 Likes

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

3 Likes

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

1 Like

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

1 Like

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

Hey, @Ana, has this been solved? I’ve had something similar (variation of this) but I don’t remember if it’s this same issue

2 Likes

I thought it has been solved. Are there any new incidents?

5 Likes

Ok, I had a variation of this. Basically, I had an ability inside about 7 conditionals. The first block inside that ability was an If statement, and that did not run, nor did any of the following code in that rule. But once I put a “wait 0” or “set trail color” in, everything worked normally.

Basically an of statement inside and ability inside 7 conditionals breaks the code

3 Likes

Cool, thanks. I’ll have a look.

4 Likes

Thank you. There might be some other things that may cause it, but it could just be 7 control scripts without any blocks in between, who knows?


My set trail fixed this issue, as it takes zero frames to execute (which is great) and the code continued. So no rush there, just something to be noted

2 Likes

@awesomeonion @Ana what’s in the new update? It bricked my E-Pad project

3 Likes

Yikes. Something we’ve realized is that we need to keep your drafts pinned to a specific version of the player in addition to the published projects. It’s on our list, but I’ll move it up the priority

4 Likes

See my new topic, I found it! (Had nothing to do with webplayer versions)

My project’s version stayed the same, it was totally different and had to to with the new removing empty ability behavior

2 Likes

We do have a stack limit to stop you from getting into an infinite loop. (i.e. if you had an ability 1 inside another ability 2 which is inside ability 3 which is inside ability 1). We’ll fix it eventually but my sense right now is that it’s kind of an edge case.

5 Likes

This bug was different. E-Pad is working fine after I removed the issue points

2 Likes

I guess this is resolved. Can I close it now?

4 Likes

This bug still occurs to some degree.

I’ll get a screenshot in a moment

You can see how there are 7+ conditionals, some inside of an ability. (About 12 till we get to the actual actions).

I don’t know if it’s based off of 7+, but the conditionals below the set trail width block won’t run if I don’t have that there, and it seems to happen only after a certain number of conditionals inside or out.

4 Likes