SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("/com/nsun")
| |
| 2 | local i = 1 | |
| 3 | local r = false | |
| 4 | ||
| 5 | - | term.clear() |
| 5 | + | function clear() |
| 6 | - | term.setCursorPos(1,1) |
| 6 | + | term.clear() |
| 7 | term.setCursorPos(1,1) | |
| 8 | - | for i=1,18 do |
| 8 | + | |
| 9 | - | r = redstone.getInput("back")
|
| 9 | + | |
| 10 | - | write(nsun.time2str().." ") |
| 10 | + | function title() |
| 11 | - | if r then |
| 11 | + | clear() |
| 12 | - | print("Energy low")
|
| 12 | + | term.setCursorPos(1,3) |
| 13 | - | else |
| 13 | + | print(" ___ __ _____ _____ ____ ___ _ ____ __")
|
| 14 | - | print("ok")
|
| 14 | + | print("| |_) / /\\ | | | | | |_ | |_) | | | |_ ( (")
|
| 15 | - | end |
| 15 | + | print("|_|_) /_/--\\ |_| |_| |_|__ |_| \\ |_| |_|__ _)_)")
|
| 16 | - | sleep(1) |
| 16 | + | |
| 17 | ||
| 18 | - | term.clear() |
| 18 | + | function runTest() |
| 19 | - | term.setCursorPos(1,1) |
| 19 | + | clear() |
| 20 | local day = "" | |
| 21 | local tx = 49 | |
| 22 | i = 1 | |
| 23 | while i < 360 do | |
| 24 | if day ~= "day "..os.day() then | |
| 25 | day = "day "..os.day() | |
| 26 | tx = 49 - string.len(day) | |
| 27 | if tx < 0 then tx = 0 end | |
| 28 | term.setCursorPos(tx,1) | |
| 29 | print(day) | |
| 30 | term.setCursorPos(1,1) | |
| 31 | end | |
| 32 | if i % 18 == 0 then | |
| 33 | term.setCursorPos(1,1) | |
| 34 | end | |
| 35 | i = i + 1 | |
| 36 | r = redstone.getInput("back")
| |
| 37 | write(nsun.time2str().." ") | |
| 38 | if r then | |
| 39 | print("Energy low")
| |
| 40 | else | |
| 41 | print("ok")
| |
| 42 | end | |
| 43 | os.queueEvent("event_marker")
| |
| 44 | local breakOut = false | |
| 45 | while true do | |
| 46 | e = os.pullEvent() | |
| 47 | if e == "key" then --add any other events that should break the loop if necessary | |
| 48 | breakOut = true | |
| 49 | elseif e == "event_marker" then | |
| 50 | break | |
| 51 | end | |
| 52 | end | |
| 53 | if breakOut then break end | |
| 54 | sleep(5) | |
| 55 | end | |
| 56 | term.clear() | |
| 57 | term.setCursorPos(1,1) | |
| 58 | end | |
| 59 | ||
| 60 | while true do | |
| 61 | title() | |
| 62 | term.setCursorPos(3,8) | |
| 63 | print ("Press Enter / Q to exit.")
| |
| 64 | ||
| 65 | local event, param = os.pullEvent ("key")
| |
| 66 | if param == 28 then | |
| 67 | runTest() | |
| 68 | elseif param == 16 then | |
| 69 | break | |
| 70 | end | |
| 71 | sleep(0.1) | |
| 72 | end | |
| 73 | ||
| 74 | clear() |