Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[Variables]--
- local monside = "right" --side of monitor
- --[Main Code]--
- function test()
- if term.isColor() == false then
- print("An Advanced Computer is required to run this program")
- sleep(3)
- os.shutdown()
- elseif peripheral.getType(monside) ~= "monitor" then
- print("An Advanced Monitor is requred to run this program")
- sleep(3)
- os.shutdown()
- else
- mon = peripheral.wrap(monside)
- width, height = mon.getSize()
- centretxt = (width/2)-2.5
- mon.setBackgroundColor(colors.white)
- mon.clear()
- note1 = 0
- note2 = 0
- note3 = 0
- note4 = 0
- note5 = 0
- if width < 29 then
- print("The monitor on the "..monside.." must be at least 3 wide")
- sleep(3)
- os.shutdown()
- elseif height < 7 or height > 12 then
- print("The monitor on the "..monside.." must be only 2 high")
- sleep(3)
- os.shutdown()
- end
- end
- end
- function drawTerm()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.clear()
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(1,19)
- term.clearLine()
- end
- function monClicked()
- memo1()
- memo2()
- memo3()
- memo4()
- memo5()
- drawTerm()
- while true do
- local event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if xPos == 12 and yPos == 3 and note1 == 0 then
- note1 = 1
- click1()
- elseif xPos == close1b and yPos == 3 and note1 == 1 then
- note1 = 0
- memo1()
- elseif xPos == 12 and yPos == 5 and note2 == 0 then
- note2 = 1
- click2()
- elseif xPos == close2b and yPos == 5 and note2 == 1 then
- note2 = 0
- memo2()
- elseif xPos == 12 and yPos == 7 and note3 == 0 then
- note3 = 1
- click3()
- elseif xPos == close3b and yPos == 7 and note3 == 1 then
- note3 = 0
- memo3()
- elseif xPos == 12 and yPos == 9 and note4 == 0 then
- note4 = 1
- click4()
- elseif xPos == close4b and yPos == 9 and note4 == 1 then
- note4 = 0
- memo4()
- elseif xPos == 12 and yPos == 11 and note5 == 0 then
- note5 = 1
- click5()
- elseif xPos == close5b and yPos == 11 and note5 == 1 then
- note5 = 0
- memo5()
- end
- end
- end
- function background()
- mon.setBackgroundColor(colors.cyan)
- mon.setCursorPos(1,1)
- mon.clearLine()
- mon.setTextColor(colors.white)
- mon.setCursorPos(centretxt, 1)
- mon.write("Memos")
- end
- function memo1()
- mon.setCursorPos(2,3)
- mon.setTextColor(colors.red)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.write("Add Memo")
- mon.setCursorPos(11,3)
- mon.setBackgroundColor(colors.green)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- function click1()
- mon.setCursorPos(2,3)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.setTextColor(colors.red)
- mon.write("Type message into computer")
- term.setCursorPos(2,19)
- input1 = read()
- ilength = string.len(input1)
- if ilength > width-11 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print("This memo is too long for your monitor. Add extra monitors, or shorten your memo")
- sleep(3)
- note1 = 0
- memo1()
- else
- drawTerm()
- mon.setCursorPos(2,3)
- mon.clearLine()
- mon.write("1) "..input1)
- close1a = width - 3
- close1b = width - 2
- mon.setCursorPos(close1a, 3)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- end
- function memo2()
- mon.setCursorPos(2,5)
- mon.setTextColor(colors.red)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.write("Add Memo")
- mon.setCursorPos(11,5)
- mon.setBackgroundColor(colors.green)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- function click2()
- mon.setCursorPos(2,5)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.setTextColor(colors.red)
- mon.write("Type message into computer")
- input1 = read()
- ilength = string.len(input1)
- if ilength > width-11 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print("This memo is too long for your monitor. Add extra monitors, or shorten your memo")
- sleep(3)
- note2 = 0
- memo2()
- else
- drawTerm()
- mon.setCursorPos(2,5)
- mon.clearLine()
- mon.write("2) "..input1)
- close2a = width - 3
- close2b = width - 2
- mon.setCursorPos(close2a, 5)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- end
- function memo3()
- mon.setCursorPos(2,7)
- mon.setTextColor(colors.red)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.write("Add Memo")
- mon.setCursorPos(11,7)
- mon.setBackgroundColor(colors.green)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- function click3()
- mon.setCursorPos(2,7)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.setTextColor(colors.red)
- mon.write("Type message into computer")
- input1 = read()
- ilength = string.len(input1)
- if ilength > width-11 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print("This memo is too long for your monitor. Add extra monitors, or shorten your memo")
- sleep(3)
- note3 = 0
- memo3()
- else
- drawTerm()
- mon.setCursorPos(2,7)
- mon.clearLine()
- mon.write("3) "..input1)
- close3a = width - 3
- close3b = width - 2
- mon.setCursorPos(close3a, 7)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- end
- function memo4()
- mon.setCursorPos(2,9)
- mon.setTextColor(colors.red)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.write("Add Memo")
- mon.setCursorPos(11,9)
- mon.setBackgroundColor(colors.green)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- function click4()
- mon.setCursorPos(2,9)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.setTextColor(colors.red)
- mon.write("Type message into computer")
- input1 = read()
- ilength = string.len(input1)
- if ilength > width-11 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print("This memo is too long for your monitor. Add extra monitors, or shorten your memo")
- sleep(3)
- note4 = 0
- memo4()
- else
- drawTerm()
- mon.setCursorPos(2,9)
- mon.clearLine()
- mon.write("4) "..input1)
- close4a = width - 3
- close4b = width - 2
- mon.setCursorPos(close4a, 9)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- end
- function memo5()
- mon.setCursorPos(2,11)
- mon.setTextColor(colors.red)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.write("Add Memo")
- mon.setCursorPos(11,11)
- mon.setBackgroundColor(colors.green)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- function click5()
- mon.setCursorPos(2,11)
- mon.setBackgroundColor(colors.white)
- mon.clearLine()
- mon.setTextColor(colors.red)
- mon.write("Type message into computer")
- input1 = read()
- ilength = string.len(input1)
- if ilength > width-11 then
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.red)
- print("This memo is too long for your monitor. Add extra monitors, or shorten your memo")
- sleep(3)
- note5 = 0
- memo5()
- else
- drawTerm()
- mon.setCursorPos(2,11)
- mon.clearLine()
- mon.write("5) "..input1)
- close5a = width - 3
- close5b = width - 2
- mon.setCursorPos(close5a, 11)
- mon.setBackgroundColor(colors.red)
- mon.setTextColor(colors.white)
- mon.write(" X ")
- end
- end
- --[Declarations of Functions]--
- test()
- background()
- monClicked()
Add Comment
Please, Sign In to add comment