Jump to content




When I use my menu(left side of the screen), the stas(right side of the screen disappears than reappears. How do I fix this?


6 replies to this topic

#1 n1ghtk1ng

  • Members
  • 58 posts

Posted 13 December 2012 - 05:13 AM

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/Re6GKQxQ

#2 nO_OnE

  • New Members
  • 15 posts

Posted 13 December 2012 - 05:15 AM

Having your code whould make fixing it a whole lot easier...

#3 anonimo182

  • Members
  • 252 posts
  • LocationIn the universe

Posted 13 December 2012 - 10:00 AM

Hi again! I already gave you a solution, what happened?

#4 n1ghtk1ng

  • Members
  • 58 posts

Posted 13 December 2012 - 12:08 PM

View PostnO_OnE, on 13 December 2012 - 05:15 AM, said:

Having your code whould make fixing it a whole lot easier...
Sorry! I copy/pasted on my phone and I thought the pastebin link was there, I'll edit it in now!

#5 n1ghtk1ng

  • Members
  • 58 posts

Posted 13 December 2012 - 12:10 PM

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
If you looked at the post again, I replied to you, but you never responded. What I said to you:

View Postn1ghtk1ng, on 13 December 2012 - 12:09 PM, said:

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
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


#6 anonimo182

  • Members
  • 252 posts
  • LocationIn the universe

Posted 13 December 2012 - 03:50 PM

View Postn1ghtk1ng, on 13 December 2012 - 12:10 PM, said:

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
If you looked at the post again, I replied to you, but you never responded. What I said to you:

View Postn1ghtk1ng, on 13 December 2012 - 12:09 PM, said:

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
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
Sorry, I didn't checked :3

Make it so at every second(?) it updates, but get the line of "if event == "timer" then", just leave the functions there, so every event can update it, and if there are any events, the timer will do it

After all, you encase the function in a loop, so it always be processed, in this case:
while true do
printFinalStats()
end


#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 14 December 2012 - 02:26 AM

View Postanonimo182, on 13 December 2012 - 03:50 PM, said:

View Postn1ghtk1ng, on 13 December 2012 - 12:10 PM, said:

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
If you looked at the post again, I replied to you, but you never responded. What I said to you:

View Postn1ghtk1ng, on 13 December 2012 - 12:09 PM, said:

View Postanonimo182, on 13 December 2012 - 10:00 AM, said:

Hi again! I already gave you a solution, what happened?
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
Sorry, I didn't checked :3

Make it so at every second(?) it updates, but get the line of "if event == "timer" then", just leave the functions there, so every event can update it, and if there are any events, the timer will do it

After all, you encase the function in a loop, so it always be processed, in this case:
while true do
printFinalStats()
end

Can I make a suggestion here though. Given that you say parallel.waitForAny(......) using this code:

function PrintFinalStats()
	    while true do
	    CheckTime()
	    printDisplay()
	    ReceiveStats()
	    end
end

will most likely cause the program to terminate saying something about yielding. so put like a sleep(0.5) or something to make the program sleep for 0.5 seconds and not quit due to lack of "yield"





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users