Jump to content




[Lua][Question]Screen Refreshing with os.pullEvent()


  • You cannot reply to this topic
2 replies to this topic

#1 exploder

  • Members
  • 69 posts
  • LocationLatvia

Posted 20 October 2012 - 06:43 PM

Hello Computercraft community.

My problem is, that when I add os.pullEvent() to my options screen the computer is waiting for response and screen is not refreshing.(Without os.pullEvent it works fine.)

I want to make time that keep refreshing and computer waiting for response at the same time, so is that possibe?

Here is the code. I didn't include os.pullEvent in the code so you could tell me where should I put it, or how?
Spoiler

Sorry for my poor English, but I hope you'll understand.
Thank you.

#2 ChunLing

  • Members
  • 2,027 posts

Posted 20 October 2012 - 07:49 PM

Use os.startTimer(0.5) and then os.pullEvent() rather than sleep. That way, the computer fires off your timer event after a half second, os.pullEvent gets the timer event, and the program continues. Or there is some other event and that gets pulled instead. Based on the event pulled, you can then do different things.

#3 exploder

  • Members
  • 69 posts
  • LocationLatvia

Posted 21 October 2012 - 06:23 PM

View PostChunLing, on 20 October 2012 - 07:49 PM, said:

Use os.startTimer(0.5) and then os.pullEvent() rather than sleep. That way, the computer fires off your timer event after a half second, os.pullEvent gets the timer event, and the program continues. Or there is some other event and that gets pulled instead. Based on the event pulled, you can then do different things.

This did the work, thank you.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users