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

Whenever I do parallel.waitForAnY() the other display disappears, then reappears in >1 seconds

Started by n1ghtk1ng, 11 December 2012 - 02:21 PM
n1ghtk1ng #1
Posted 11 December 2012 - 03:21 PM
I hope the title explained my problem right. What the program does is on one side display an input/stats(currently just have Solar Panels)
and on the left side is my menu that I can scroll through and enable/disable with enter which outputs things. Whenever I press enter (or the up/down arrow to scroll) the right(input/stats) side disappears, then reappears in about 1 second. How can I make this not do that?

Code : http://pastebin.com/qJpJLKPm
anonimo182 #2
Posted 12 December 2012 - 10:09 AM
You don't have to use parallel, you need more like a timer for os.pullEvent(), so every time the timer start an event, then you update the right screen, like this:

local tTimer = os.startTimer(the_time_you_want_it_to_wait_to_update)
local event, param = os.pullEvent()
if event == "timer" then
--update the right screen code
end
n1ghtk1ng #3
Posted 12 December 2012 - 10:31 AM
You don't have to use parallel, you need more like a timer for os.pullEvent(), so every time the timer start an event, then you update the right screen, like this:

local tTimer = os.startTimer(the_time_you_want_it_to_wait_to_update)
local event, param = os.pullEvent()
if event == "timer" then
--update the right screen code
end
Sorry, I don't quite get what you mean. Can you place it in my code so that I can understand it better?

EDIT: I understand how to use the timer, but I don't understand how to use it in my code.
EDIT2: Nevermind! I reread it a little bit later and I understand it now. Thanks!
EDIT3: Tested, it doesn't even print the right side of the screen anymore when I do your timer suggestion. Anyother ideas?

function PrintFinalStats()
local tTimer = os.startTimer(3)
local event, param = os.pullEvent()
if event == "timer" then
  CheckTime()
  printDisplay()
  ReceiveStats()
end
end