Ok I'm making a project, and I need to make os.sleep and os.startTimer, but how?
How to make os.sleep, os.startTimer?
Started by LeDark Lua, Jan 02 2016 10:53 AM
7 replies to this topic
#1
Posted 02 January 2016 - 10:53 AM
#2
Posted 02 January 2016 - 11:41 AM
Why would you want to make it? Sleep works like this:
local timer = os.startTimer()
repeat
local event, tmr = coroutine.yield("timer")
until tmr == timer
local timer = os.startTimer()
repeat
local event, tmr = coroutine.yield("timer")
until tmr == timer
Edited by Creator, 02 January 2016 - 11:42 AM.
#3
Posted 02 January 2016 - 11:50 AM
I know how it works, but I want to make it, because it bugs out the buffer I made. Or its my buffer, can't tell
#4
Posted 02 January 2016 - 12:56 PM
LeDark Lua, on 02 January 2016 - 11:50 AM, said:
I know how it works, but I want to make it, because it bugs out the buffer I made. Or its my buffer, can't tell
Anyway, there is no way to reimplement os.startTimer without using os.startTimer. The actual timer stuff is done natively.
#5
Posted 02 January 2016 - 01:01 PM
Lignum, on 02 January 2016 - 12:56 PM, said:
LeDark Lua, on 02 January 2016 - 11:50 AM, said:
I know how it works, but I want to make it, because it bugs out the buffer I made. Or its my buffer, can't tell
Anyway, there is no way to reimplement os.startTimer without using os.startTimer. The actual timer stuff is done natively.
#6
Posted 02 January 2016 - 01:33 PM
I'm trying to run worm on it, or any program that uses term/paintutils.
Bug: it like shifts itself upwards
Bug: it like shifts itself upwards
Edited by LeDark Lua, 02 January 2016 - 02:21 PM.
#7
Posted 02 January 2016 - 05:06 PM
Definitely a problem in your code. Post your code.
#8
Posted 02 January 2016 - 05:56 PM
My code: pastebin
or
Usage:
Make a main buffer according to your screen, then make a program buffer and draw that on the main buffer.
or
pastebin get LAejwLBZ gl
Usage:
os.loadAPI( "gl" ) local buffer = gl.create(x, y, width, height) buffer:clear( backgroundColor, textColor ) buffer:clearLine( y, backgroundColor, textColor ) buffer:drawChar( x, y, char, backgroundColor, textColor ) buffer:drawText( x, y, text, backgroundColor, textColor ) local aTerm = buffer:getTerm() buffer:draw( term )
Make a main buffer according to your screen, then make a program buffer and draw that on the main buffer.
Edited by LeDark Lua, 02 January 2016 - 06:01 PM.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











