Advertisement
Guest User

startup

a guest
Nov 24th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1. mon = peripheral.wrap("left")
  2. local monx, mony = mon.getSize()
  3.  
  4. term.clear()
  5. mon.clear()
  6. mon.setCursorPos(5,1)
  7.  
  8. mon.setTextColor(colors.blue)
  9. mon.write("To Do List")
  10.  
  11. mon.setTextColor(colors.orange)
  12. mon.setCursorPos(1,2)
  13. mon.write("Green Means Completed, Red Means Not")
  14.  
  15. mon.setCursorPos(1,4)
  16.  
  17.  
  18. while true do
  19.  
  20.   monx, mony = mon.getSize()
  21.   temp = mony
  22.   mony = 4
  23.  
  24.   repeat
  25.     numberx, numbery = mon.getCursorPos()
  26.     mon.setCursorPos(monx - 6, mony)
  27.     mon.setTextColor(colors.cyan)
  28.     mon.write("Line " .. mony)
  29.     numbery = numbery + 2
  30.     mony = mony + 2
  31.   until mony >= temp
  32.  
  33.  
  34.  
  35.   term.setTextColor(colors.blue)
  36.   term.setCursorPos(11,1)
  37.   term.write("Welcome to the To Do List")
  38.   term.setTextColor(colors.red)
  39.  
  40.   term.setCursorPos(1,2)
  41.   term.write("Note: All list items are limited to 7 characters")
  42.   term.setCursorPos(1,3)
  43.   term.write("before the end of the monitor.")
  44.   term.setCursorPos(1,4)
  45.   term.write("Add more monitors to increase length of items.")
  46.   term.setCursorPos(1,5)
  47.   term.write("Minimum Monitor Width is 4 Blocks Wide")
  48.  
  49.   term.setTextColor(colors.orange)
  50.   term.setCursorPos(1,7)
  51.   term.write("Follow the Below Prompts to Edit To Do List")
  52.   term.setTextColor(colors.white)
  53.   term.setCursorPos(1,8)
  54.  
  55.   mon.setTextColor(colors.red)
  56.   mon.write("> ")
  57.   mon.setTextColor(colors.white)
  58.  
  59.   term.write("Enter Line to Edit: ")
  60.  
  61.   line = read()
  62.   line = tonumber(line)
  63.  
  64.   if line ~= nil then
  65.  
  66.   if (line % 2 ~= 0) or (line < 4) then
  67.     term.write("Line Invalid")
  68.     sleep(1)
  69.   else
  70.  
  71.   term.write("Enter List Item or Type C for Completed,")
  72.   term.setCursorPos(1,10)
  73.   term.write("NC for Not Completed or DEL to Delete: ")
  74.   term.setCursorPos(1,11)
  75.  
  76.   newline = read()
  77.   mon.setCursorPos(1,line)
  78.  
  79.   if (newline == "C") or (newline == "c") then
  80.     mon.setTextColor(colors.green)
  81.     mon.write("> ")
  82.   elseif (newline == "NC") or (newline == "nc") or (newline == "Nc") or (newline == "nC") then
  83.     mon.setTextColor(colors.red)
  84.     mon.write("> ")
  85.   elseif (newline == "DEL") or (newline == "Del") or (newline == "DEl") or (newline == "DeL") or (newline == "dEl") or (newline == "dEL") or (newline == "deL") or (newline == "del") then
  86.     mon.setTextColor(colors.red)
  87.     mon.clearLine()
  88.   else
  89.     mon.clearLine()
  90.     mon.setTextColor(colors.red)
  91.     mon.write("> ")
  92.     mon.setTextColor(colors.white)
  93.     mon.write(newline)
  94.   end
  95.   end
  96.   else
  97.   term.setTextColor(colors.red)
  98.     term.write("Invalid Line")
  99.     sleep(1)
  100.   end
  101.  
  102.   if line ~=nil then
  103.  
  104.   if (line % 2 == 0) and (line >= 4) then
  105.     term.write("Todo List Updated")
  106.     sleep(1)
  107.     term.clear()
  108.   else
  109.     term.clear()
  110.   end
  111.   else
  112.   term.clear()
  113.   end
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement