Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Mu Lambda API v1.0
- -- by MCKerrnel
- --
- -- YouTube: http://www.youtube.com/MCKerrnel
- -- Twitter: @MCKerrnel
- --
- -- This is a set of common functions that
- -- most of the system programs will use.
- -- Always set the monitor peripheral.
- local monitor = peripheral.wrap("back")
- -- A generic function to allow us to print text
- -- to the monitor at a specific location and in
- -- a specific color.
- function tp(textToPrint, column, row, fgcolour, bgcolour)
- monitor.setCursorPos(column, row)
- monitor.setTextColor(fgcolour)
- monitor.setBackgroundColor(bgcolour)
- monitor.write(textToPrint)
- end
- -- Clears the monitor.
- function clear()
- monitor.setCursorPos(0, 0)
- monitor.setTextColor(colors.white)
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- end
- -- Menu Box
- -- This function will create a clickable region
- -- in a box format. You provide it with the
- -- dimensions, label, and colour palette, and
- -- it will return a table with the clickable
- -- dimensions.
- function menuBox(title, boxFG, boxBG, textFG, textBG, xA, yA, width, height)
- drawBox(boxFG, boxBG, xA, yA, width, height)
- tp(title, xA + 2, yA + 2, textFG, textBG)
- end
- -- Draws just a box.
- function drawBox(boxFG, boxBG, xA, yA, width, height)
- local bline = ""
- for hCount = 0, height - 1, 1 do
- bline = ""
- for wCount = 1, width, 1 do
- bline = bline.." "
- end
- tp(bline, xA, yA + hCount, boxFG, boxBG)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment