Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Config options
- local monitorSide = "top"
- local MtextScale = 1
- local Tcolor = colors.blue
- local Bcolor = colors.black
- local topLabel = "Announcements"
- --Don't touch anything below this line!
- local monitor = peripheral.wrap(monitorSide)
- monitor.setTextScale(MtextScale)
- monitor.setTextColor(Tcolor)
- monitor.setBackgroundColor(Bcolor)
- term.setTextColor(Tcolor)
- term.setBackgroundColor(Bcolor)
- term.clear()
- term.setCursorPos(1, 1)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- term.redirect(monitor)
- print(topLabel)
- term.restore()
- print(topLabel)
- function doPrint(text)
- if text == nil then
- term.redirect(monitor)
- print()
- term.restore()
- print()
- else
- term.redirect(monitor)
- print(text)
- term.restore()
- print(text)
- end
- end
- doPrint()
- doPrint("Loading notes...")
- local delay
- if math.random(1,2) == 2 then delay = math.random(1, 4) / math.random(2, 3) else delay = math.random(1, 4) end
- sleep(delay)
- local handle = fs.open("notes", "r")
- local compiled = ""
- local first = true
- while true do
- local notes = handle.readLine()
- if notes == nil then break end
- if first == false then compiled = compiled.."\n" end
- compiled = compiled..notes
- first = false
- end
- monitor.setCursorPos(1, 3)
- term.setCursorPos(1, 3)
- doPrint("Notes loaded from notefile:")
- doPrint("-------------------------------------")
- monitor.setTextColor(colors.white)
- term.setTextColor(colors.white)
- doPrint(compiled)
- monitor.setTextColor(Tcolor)
- term.setTextColor(Tcolor)
- doPrint("-------------------------------------")
- doPrint("End of notes")
- --[[
- x, y = monitor.getSize()
- monitor.setCursorPos(x-7, y)
- monitor.write("[Reboot]")
- monitor.setCursorPos(1, 10)
- monitor.write("x: "..x.." y: "..y)
- ]]
- while true do
- --[[monitor.setCursorBlink(true)
- term.setCursorBlink(true)
- event, param1, param2, param3 = os.pullEventRaw()
- param1 = param1 or ""
- param2 = param2 or ""
- param3 = param3 or ""
- print(event, ", ", param1, ", ", param2, ", ", param3)]]
- input = read()
- termX, termY = term.getCursorPos()
- monitorX, monitorY = monitor.getCursorPos()
- term.setCursorPos(1, 1)
- monitor.setCursorPos(1, 1)
- term.clearLine()
- monitor.clearLine()
- doPrint(topLabel)
- term.setCursorPos(termX, termY)
- monitor.setCursorPos(termX, termY)
- if input == "reboot" then
- print("Reboot: Are you sure? (yes/no)")
- input2 = read()
- if input2 == "yes" then
- print("Rebooting...")
- sleep(0.5)
- os.reboot()
- else
- print("Reboot cancelled!")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment