Jump to content




Computer Freeze



8 replies to this topic

#1 Hayden_Almeida

  • Members
  • 48 posts

Posted 11 October 2017 - 08: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/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.


#2 SquidDev

  • Members
  • 1,081 posts
  • LocationDoes anyone put something serious here?

Posted 11 October 2017 - 08: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?

#3 Hayden_Almeida

  • Members
  • 48 posts

Posted 11 October 2017 - 09:11 PM

View PostSquidDev, 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?

https://pastebin.com/ZvT8iPzZ

#4 KingofGamesYami

  • Members
  • 2,827 posts
  • LocationUnited States of America

Posted 11 October 2017 - 09: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


#5 Hayden_Almeida

  • Members
  • 48 posts

Posted 11 October 2017 - 10:12 PM

View PostKingofGamesYami, 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:

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.


#6 KingofGamesYami

  • Members
  • 2,827 posts
  • LocationUnited States of America

Posted 11 October 2017 - 10: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.

#7 Hayden_Almeida

  • Members
  • 48 posts

Posted 11 October 2017 - 10: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

#8 KingofGamesYami

  • Members
  • 2,827 posts
  • LocationUnited States of America

Posted 11 October 2017 - 11:10 PM

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.

#9 Dave-ee Jones

  • Members
  • 413 posts
  • LocationVan Diemen's Land

Posted 12 October 2017 - 12: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users