Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

[Help] Double Loop Break Bug or Just me?

TheOdie

Villager
Xy$
0.00
I'm trying to break from a double loop (picture below). The second inner loop that checks the Y breaks, but the one for the X does not. I've been using this all my life and it had always worked up until now. Am I just doing something wrong?

Thanks in advance!

myerror.PNG
 

Dad3353

Praised Adventurer
@TheOdie ...

As far as I can see, it should work. I simulated it in a Project, and followed the Variable, and the outer Break Loop doesn't seem to have any effect (or breaks a different loop than that anticipated...). I got it to work by cheating, using Labels, like this...
◆Control Variables:#0001 = 3
◆Control Variables:#0002 = 3
◆Loop
◆If:#0001 = 0
◆Jump to Label:End_Here
◆Break Loop

:End
◆Loop
◆If:#0002 = 0
◆Break Loop

:End
◆Control Variables:#0002 -= 1

:Repeat Above
◆Control Variables:#0001 -= 1

:Repeat Above

◆Label:End_Here
◆Text:None, Window, Bottom
: :Done
...but it should work as originally written. Yes, it looks like a 'bug' to me. Anyone with a better explanation of what's going on here..?
 

TheOdie

Villager
Xy$
0.00
Yeah that's what I'm doing for the time being. I also noticed that if you put it after the break loop, it doesn't execute. It's got to be a bug. Glad to know I'm not crazy :D
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Interesting bug It's good to know about this though, I wonder if there will be a fix for it soon. Labels are a good solution nonetheless, so, for now I'm going to keep this open just in case someone knows about this bug and a real solution to the looping.
 

Lore

Resident Dragon
I'm not fluent in writing code but I tend to, for whatever reason, seem to be able to understand most of it. And looking at this, I can see what you are trying to do. However, if I may ask a question first... have you tried converting the code into a conditional argument?

Something like this:


◆Control Variables:#0007 = 3
◆Control Variables:#0008 = 3
◆Loop
◆If:#0001 = 0
◆Break Loop
◆Else:
◆If:#0002 = 0
◆Break Loop

:End
◆Control Variables:#0002 -= 1

:Repeat Above
◆Control Variables:#0001 -= 1

:Repeat Above

This is just a suggestion, and I don't know if this would fix your issue, but I hope it helps. As I said, I'm not fluent in code and it may not work, but it's just my 2 cents.
 
Top