This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LeDark Lua's profile picture

for loop problem.

Started by LeDark Lua, 19 September 2015 - 01:39 PM
LeDark Lua #1
Posted 19 September 2015 - 03:39 PM
Update Code: HERE

So what I mean by for loops is popups is that when I click on a window, other window pops up [ the window behind him ] and I dont know how to stop it.

For ex: Lyqyd's Window OS knows how to prevent that.

Can anyone tell me how to prevent other window popups? Thanks.
Edited on 19 September 2015 - 03:46 PM
LeDark Lua #2
Posted 19 September 2015 - 05:46 PM
Ehm, please anybody?
HPWebcamAble #3
Posted 19 September 2015 - 05:57 PM
The code you posted doesn't actually do anything on its own.

Could you post the full code and maybe some screenshots?
LeDark Lua #4
Posted 19 September 2015 - 06:13 PM
On its own It checks when to close, move window. And it repositions the window so the clicked window would be the first. But how loops work the first window gets last and then BAAAM: Bugs.

And screenshots, ok.
LeDark Lua #5
Posted 19 September 2015 - 06:22 PM
Screenshot one before clicking on the error window:

After clicking on the error window:
Exerro #6
Posted 19 September 2015 - 06:26 PM
You could break out of the loop once you have performed the action on some window.
LeDark Lua #7
Posted 19 September 2015 - 06:28 PM
Wait, ill try….

EDIT: Nope…. Can I have like a code example, or a modified version of mine please?
Edited on 19 September 2015 - 04:32 PM
Exerro #8
Posted 19 September 2015 - 06:38 PM
Oooh, ignore that. You're going through from window 1 (first added I guess) to window #windows (last added I guess), so the first window you check will be the bottom layer one, not top layer. Change the for loop to:

for i = #windows, 1, -1 do
LeDark Lua #9
Posted 19 September 2015 - 06:42 PM
And how to activate one window? Because it highlights two of them, and I want so that the can popup trough other windows if its clicked on his border and not other windows border. Well the "Windows" mechanic.
LeDark Lua #10
Posted 20 September 2015 - 09:06 AM
Ohhhh, I got it. Thanks awsumben13!!!!!!