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

[Lua]OS update problems

Started by darkroom, 04 January 2013 - 06:15 AM
darkroom #1
Posted 04 January 2013 - 07:15 AM
Ok so i am working on and OS and i almost have the UI done (Thats the hardest part because of the way i set up the handler). Anyway I want these "worms" to draw across the screen(Basically they are lines that move across the screen horizontally) but for some reason i can't get them to update. I tried use parallel but that didn't work :/ then I tried force updating it with os.startTimer but that just caused a ton of flickering. Also look for the functions Update() and UpdateWorms(). Any ideas?
Pastebin:
http://pastebin.com/zA6pSjaU
Controls:
You can click on App Names to bring up a sub menu
Enter shuts down the program
Bubba #2
Posted 04 January 2013 - 07:34 AM
-snip-

Looked at your code and noticed that actually my implementation was pretty much the same. You say that you're having screen flickering issues? Try using os.startTimer(0.1) rather than sleep(0.1). Not sure if it will make a difference but you can give it a shot.
darkroom #3
Posted 04 January 2013 - 07:50 AM
http://pastebin.com/cpaJgrSy
I updated the code still doesn't work :/
Also do you like the UI?
darkroom #4
Posted 04 January 2013 - 08:57 AM
-snip-

Looked at your code and noticed that actually my implementation was pretty much the same. You say that you're having screen flickering issues? Try using os.startTimer(0.1) rather than sleep(0.1). Not sure if it will make a difference but you can give it a shot.
That didn't work either this is so weird….
remiX #5
Posted 04 January 2013 - 09:21 AM
I'm confused on what you're trying to do.
What I understand is that you want the text of the Apps or whatever scroll from left to right all the time?
Bubba #6
Posted 04 January 2013 - 09:25 AM
No he has a "worm" scroll across the page from right to left. My guess is that your problem lies in the number of different places you have "timerID = os.startTimer()". Try putting that in your pullEvent function (and ONLY your pullEvent function) so that while you are waiting for a click the screen updates. Also I was confused by your "wd" variable, which would make it so that the wormDraw function only draws a worm to the screen every 10 cycles. Try removing that too.
darkroom #7
Posted 04 January 2013 - 09:54 AM
No he has a "worm" scroll across the page from right to left. My guess is that your problem lies in the number of different places you have "timerID = os.startTimer()". Try putting that in your pullEvent function (and ONLY your pullEvent function) so that while you are waiting for a click the screen updates. Also I was confused by your "wd" variable, which would make it so that the wormDraw function only draws a worm to the screen every 10 cycles. Try removing that too.
I got it to work a lot better thanks to you guys :)/> but now I have a problem where the worm stops moving across the screen. I think it happens because the timer goes off at the same time as you do some other thing. New code:
Pastebin:
http://pastebin.com/KTXU1db1
The more I think about it the more I think i should rewrite the whole thing with OS in mind instead of UI :)/>
Bubba #8
Posted 04 January 2013 - 10:02 AM
No he has a "worm" scroll across the page from right to left. My guess is that your problem lies in the number of different places you have "timerID = os.startTimer()". Try putting that in your pullEvent function (and ONLY your pullEvent function) so that while you are waiting for a click the screen updates. Also I was confused by your "wd" variable, which would make it so that the wormDraw function only draws a worm to the screen every 10 cycles. Try removing that too.
I got it to work a lot better thanks to you guys :)/> but now I have a problem where the worm stops moving across the screen. I think it happens because the timer goes off at the same time as you do some other thing. New code:
Pastebin:
http://pastebin.com/KTXU1db1
The more I think about it the more I think i should rewrite the whole thing with OS in mind instead of UI :)/>

Yeah build the logic of the OS first and have a clear idea in mind of what you want to do before building the UI. It'll make the process waaay easier.