Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oldevent = os.pullEvent
- os.pullEvent = os.pullEventRaw
- oldt = 6480
- if fs.exists("t") then
- f = fs.open("t", "r")
- oldt = tonumber(f.readAll())
- f.close()
- end
- while true do
- math.randomseed = os.time()
- mon = peripheral.wrap("top")
- mon.setTextScale( 4 )
- function clock()
- t = 0
- while true do
- mon.write(math.floor( t / 60 ) .. ":" .. t % 60 )
- sleep(0.001)
- t = t + 129
- mon.clear()
- mon.setCursorPos(1, 1)
- if t > 6420 then break end
- end
- t = oldt
- while true do
- if t < 60 then
- if not rs.getOutput("right") then
- rs.setOutput("right", true)
- end
- elseif t < 240 then
- if not rs.getOutput("left") then
- rs.setOutput("left", true)
- end
- else
- rs.setOutput("left", false)
- rs.setOutput("right", false)
- end
- if t > 0 then
- mon.clear()
- mon.setCursorPos(1, 1)
- mon.write(math.floor( t / 60 ) .. ":" .. t % 60 )
- f = fs.open("t", "w")
- f.writeLine(t)
- f.close()
- sleep(1)
- t = t - 1
- rs.setOutput("bottom", false)
- else
- rs.setOutput("bottom", true)
- while t <= 0 do
- mon.clear()
- mon.setCursorPos(1, 1)
- randstr = string.char(math.random(1,150),math.random(1,150),math.random(1,150),math.random(1,150),math.random(1,150),math.random(1,150) )
- mon.write(randstr)
- sleep(0.05)
- end
- end
- end
- end
- function input()
- sleep(10)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- if t > 240 then
- sleep(2)
- else
- input = read()
- if input == "4 8 15 16 23 42" then
- oldt = 6480
- rs.setOutput("bottom", false)
- rs.setOutput("right", false)
- rs.setOutput("left", false)
- return
- end
- end
- end
- end
- parallel.waitForAny(clock,input)
- end
Advertisement
Add Comment
Please, Sign In to add comment