Help me with os.time() please
#1
Posted 16 March 2013 - 01:52 PM
#2
Posted 16 March 2013 - 02:01 PM
#3
Posted 16 March 2013 - 02:08 PM
#4
Posted 16 March 2013 - 09:44 PM
local sX, sY = term.getSize()
local function updateTime()
local updateTimer = os.startTimer( 1 )
while true do
local _, p = os.pullEventRaw( 'timer' )
if p == updateTimer then
local cx, cy = term.getCursorPos() -- if you have functions that write a lot, you will need this
local t = textutils.formatTime( os.time(), false )
term.setCursorPos( sX - #t, 1 )
write( t )
term.setCursorPos( cx, cy )
end
end
end
local function otherMainFunction()
while true do
...
end
end
parallel.waitForAny( updateTime, otherMainFunction )
#5
Posted 17 March 2013 - 01:09 AM
#8
Posted 17 March 2013 - 01:29 AM
#9
Posted 17 March 2013 - 01:46 AM
local function runOs() while true do -- os code -- this needs to have a sleep or a os.pullEvent in it so that it yields and doesnt stop the program from running end end local function timeUpdate() local timeUpdate = os.startTimer( 1 ) while true do local _, triggered = os.pullEventRaw( 'timer' ) if triggered == timeUpdate then titleTime() timeUpdate = os.startTimer( 1 ) end end end parallel.waitForAny( timeUpdate, runOs )
#10
Posted 17 March 2013 - 02:02 AM
#11
Posted 17 March 2013 - 02:13 AM
spyman68, on 17 March 2013 - 02:02 AM, said:
#12
Posted 17 March 2013 - 02:30 AM
#13
Posted 17 March 2013 - 02:31 AM
#14
Posted 17 March 2013 - 03:47 AM
#15
Posted 17 March 2013 - 06:17 AM
Zoinky, on 16 March 2013 - 02:01 PM, said:
He could always use coroutine.
SuicidalSTDz, on 16 March 2013 - 02:08 PM, said:
Could use this though, prefer it actually
#16
Posted 17 March 2013 - 03:55 PM
SuicidalSTDz, on 17 March 2013 - 03:47 AM, said:
cube123, on 17 March 2013 - 06:17 AM, said:
Zoinky, on 16 March 2013 - 02:01 PM, said:
He could always use coroutine.
SuicidalSTDz, on 16 March 2013 - 02:08 PM, said:
Could use this though, prefer it actually
#17
Posted 17 March 2013 - 04:04 PM
vector.new(gps.locate(TheOriginalBIT))Muahahaha!
#18
Posted 18 March 2013 - 02:16 AM
#19
Posted 18 March 2013 - 09:01 AM
#20
Posted 18 March 2013 - 02:25 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











