Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Check for adv monitor
- function advMon(a, b)
- if not a.isColor() then
- niceError("Please upgrade "..b.." monitor to","the \"Advanced\" version.","")
- end
- end
- --Set up two peripherals
- function findTperipherals(p)
- s = {}
- for _,v in pairs(rs.getSides()) do
- if #s == 2 then break end
- if peripheral.getType(v) == p then
- table.insert(s, v)
- end
- end
- return unpack( s )
- end
- function wrapTperipherals(j, k)
- if k ~= nil then
- MO = 2
- l = peripheral.wrap(j)
- advMon(l, j)
- m = peripheral.wrap(k)
- advMon(m, k)
- elseif j ~= nil then
- MO = 1
- l = peripheral.wrap(j)
- advMon(l, j)
- notes("IMPORTANT", "With a second advanced monitor","you will see more information.")
- sleep(3)
- else
- niceError("No advanced monitors attached to the computer","")
- return
- end
- end
- --Center text print
- function cprint (t)
- local x2, y2 = term.getCursorPos()
- local x, y = term.getSize()
- term.setCursorPos(math.ceil((x/2) - (t:len()/2)), y2)
- print(t)
- end
- --Notes
- function notes(te, ta, tb)
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.cyan)
- cprint("---------========= "..te.." =========---------")
- term.setCursorPos(1, 3)
- term.setTextColor(colors.white)
- cprint(ta)
- cprint(tb)
- term.setCursorPos(1, 6)
- term.setTextColor(colors.cyan)
- cprint("---------========= "..te.." =========---------")
- term.setCursorPos(1, 8)
- term.setTextColor(colors.white)
- end
- --Header function
- function header(te)
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.cyan)
- cprint("---------========= "..te.." =========---------")
- term.setTextColor(colors.white)
- end
- --Header in current Pos
- function headerW(te)
- term.setTextColor(colors.cyan)
- cprint("---------========= "..te.." =========---------")
- term.setTextColor(colors.white)
- end
- --Error Messages
- function niceError(Ea, Eb)
- header("Error!")
- term.setCursorPos(1, 3)
- cprint(Ea)
- cprint(Eb)
- local x, y = term.getCursorPos()
- if Eb == "" then
- y2 = y
- elseif Eb ~= "" then
- y2 = y + 1
- end
- term.setCursorPos(1, y2)
- term.setTextColor(colors.cyan)
- cprint("---------========= Error! =========---------")
- term.setTextColor(colors.white)
- error()
- end
Advertisement
Add Comment
Please, Sign In to add comment