Computer Freeze
Hayden_Almeida 11 Oct 2017
My code runs application for Nuclear Reator and uses While LOOP every 1.5 seconds. I think there is no problem with my code and i'm not using EVENT or something like that.
Using only rs.setBundledOutput and rs.TestBundledInput things like that.
Only thing i noticed is the LOG on my fml-client-latest.log:
PASTE BIN with the latest Lines: https://pastebin.com/eyDjSaaj
it freezes event i'm NOT looking inside GUI of Computer. Because my program reads button pressed with the function rs.testBundledInput. And if i press the button and nothing happens, i know the computer froze.
USING: Minecraft 1.7.10
ComputerCraft version: 1.75
Edited by Hayden_Almeida, 11 October 2017 - 08:14 PM.
Using only rs.setBundledOutput and rs.TestBundledInput things like that.
Only thing i noticed is the LOG on my fml-client-latest.log:
PASTE BIN with the latest Lines: https://pastebin.com/eyDjSaaj
it freezes event i'm NOT looking inside GUI of Computer. Because my program reads button pressed with the function rs.testBundledInput. And if i press the button and nothing happens, i know the computer froze.
USING: Minecraft 1.7.10
ComputerCraft version: 1.75
Edited by Hayden_Almeida, 11 October 2017 - 08:14 PM.
SquidDev 11 Oct 2017
The attached log does not indicate any issue with ComputerCraft - it's just standard inventory tweaks output.
It's unlikely that this is a bug with ComputerCraft - the issue is probably with your code. In order to diagnose this, could you attach the program as well?
It's unlikely that this is a bug with ComputerCraft - the issue is probably with your code. In order to diagnose this, could you attach the program as well?
Hayden_Almeida 11 Oct 2017
SquidDev, on 11 October 2017 - 08:25 PM, said:
The attached log does not indicate any issue with ComputerCraft - it's just standard inventory tweaks output.
It's unlikely that this is a bug with ComputerCraft - the issue is probably with your code. In order to diagnose this, could you attach the program as well?
It's unlikely that this is a bug with ComputerCraft - the issue is probably with your code. In order to diagnose this, could you attach the program as well?
https://pastebin.com/ZvT8iPzZ
KingofGamesYami 11 Oct 2017
It would be incredibly difficult to time your button presses such that the button is pressed during the milliseconds of execution in between the seconds of sleep.
Your program's execution will look like this:
Your program's execution will look like this:
Spoiler
Hayden_Almeida 11 Oct 2017
KingofGamesYami, on 11 October 2017 - 09:42 PM, said:
It would be incredibly difficult to time your button presses such that the button is pressed during the milliseconds of execution in between the seconds of sleep.
Your program's execution will look like this:
Your program's execution will look like this:
Spoiler
Its not difficult, the button works fine. If i set the time to REFRESH for 2 seconds, there is a chance of 50% to capture the button press because it's stays holding for 1 sec.
How to solve this problem?
Edited by Hayden_Almeida, 11 October 2017 - 10:14 PM.
KingofGamesYami 11 Oct 2017
Don't call sleep. Ever. Anywhere.
Instead, rely on timer events for updating the reactor and redstone events for responding to button presses.
Instead, rely on timer events for updating the reactor and redstone events for responding to button presses.
Hayden_Almeida 11 Oct 2017
The problem never was the sleep. I use then since i start coding in CC.
I've create another script, and this dont freezes: https://pastebin.com/ZPSCun38
I've create another script, and this dont freezes: https://pastebin.com/ZPSCun38
KingofGamesYami 11 Oct 2017
That script sleeps for a maximum of 0.5 seconds when a button isn't pressed. That means there is a 100% chance of the script noticing the button being pressed, unlike your other script.
Dave-ee Jones 12 Oct 2017
Why do you need the 'sleep()'s anyway? Couldn't you just test the bundled output, check if it matches the old bundled output, if it doesn't then do something? If it does match then just treat it as the output hasn't changed yet because of the 0.5s timer it takes for the output to come off.