Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("/com/nsun")
- local i = 1
- local r = false
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function title()
- clear()
- term.setCursorPos(1,3)
- print(" ___ __ _____ _____ ____ ___ _ ____ __")
- print("| |_) / /\\ | | | | | |_ | |_) | | | |_ ( (")
- print("|_|_) /_/--\\ |_| |_| |_|__ |_| \\ |_| |_|__ _)_)")
- end
- function runTest()
- clear()
- local day = ""
- local tx = 49
- i = 1
- while i < 360 do
- if day ~= "day "..os.day() then
- day = "day "..os.day()
- tx = 49 - string.len(day)
- if tx < 0 then tx = 0 end
- term.setCursorPos(tx,1)
- print(day)
- term.setCursorPos(1,1)
- end
- if i % 18 == 0 then
- term.setCursorPos(1,1)
- end
- i = i + 1
- r = redstone.getInput("back")
- write(nsun.time2str().." ")
- if r then
- print("Energy low")
- else
- print("ok")
- end
- os.queueEvent("event_marker")
- local breakOut = false
- while true do
- e = os.pullEvent()
- if e == "key" then --add any other events that should break the loop if necessary
- breakOut = true
- elseif e == "event_marker" then
- break
- end
- end
- if breakOut then break end
- sleep(5)
- end
- term.clear()
- term.setCursorPos(1,1)
- end
- while true do
- title()
- term.setCursorPos(3,8)
- print ("Press Enter / Q to exit.")
- local event, param = os.pullEvent ("key")
- if param == 28 then
- runTest()
- elseif param == 16 then
- break
- end
- sleep(0.1)
- end
- clear()
Advertisement
Add Comment
Please, Sign In to add comment