49 posts
Posted 11 October 2017 - 09:13 PM
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/eyDjSaajit 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.10ComputerCraft version:
1.75
Edited on 11 October 2017 - 07:14 PM
1426 posts
Location
Does anyone put something serious here?
Posted 11 October 2017 - 09:25 PM
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?
49 posts
Posted 11 October 2017 - 10:11 PM
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?
https://pastebin.com/ZvT8iPzZ
3057 posts
Location
United States of America
Posted 11 October 2017 - 10:42 PM
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:
Spoiler
Execution
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Execution
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Repeat
note: Unresponsive would actually be repeated many more times than it is here, but I don't want to type it out.
49 posts
Posted 11 October 2017 - 11:12 PM
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:
Spoiler
Execution
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Execution
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Unresponsive
Repeat
note: Unresponsive would actually be repeated many more times than it is here, but I don't want to type it out.
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 on 11 October 2017 - 09:14 PM
3057 posts
Location
United States of America
Posted 11 October 2017 - 11:27 PM
Don't call sleep. Ever. Anywhere.
Instead, rely on
timer events for updating the reactor and
redstone events for responding to button presses.
49 posts
Posted 11 October 2017 - 11:44 PM
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
3057 posts
Location
United States of America
Posted 12 October 2017 - 12:10 AM
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.
467 posts
Location
Van Diemen's Land
Posted 12 October 2017 - 01:29 AM
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.