Advertisement
Guest User

todo

a guest
Aug 1st, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.66 KB | None | 0 0
  1. local things = {}
  2. local dates = {}
  3. local players = {}
  4. local slc = 0
  5.  
  6.  
  7. --API Methods
  8.  
  9. function screen()
  10.   term.clear()
  11.   term.setCursorPos(1,1)
  12. end
  13.  
  14. function todo( date, index, player,section )
  15.   table.insert(things, section, index)
  16.   table.insert(dates, section, date)
  17.   table.insert(players, section, player)
  18. end
  19.  
  20. function add()
  21.   screen()
  22.   print("New Todo section!")
  23.   print("What is the new mission? ")
  24.   mission = read()
  25.   screen()
  26.  
  27.   print("What is the time this mission is added? ")
  28.   day = read()
  29.   screen()
  30.  
  31.   print("Who is making this mission? ")
  32.   human = read()
  33.   screen()
  34.  
  35.   number = slc
  36.  
  37.   todo(day,mission,human,number)
  38. end
  39.  
  40. function gadets()
  41.   term.setCursorPos(34,18)
  42.   term.setTextColor(colors.red)
  43.   term.write("Press 'h' for help")
  44.   term.setTextColor(1)
  45.   term.setCursorPos(1,1)
  46. end
  47.  
  48. function helpScreen()
  49.   screen()
  50.   print("Press 'a'to add new mission")
  51.   print(c)
  52.   print("Press 'c' to remove all missions")
  53.   print(c)
  54.   print("Press 't' to stop the program")
  55.   term.setCursorPos(1,18)
  56.   term.write("Press eny key to continue..")
  57.   term.setCursorPos(1,1)
  58. end
  59.  
  60. --Main Methods
  61.  
  62. function printScreen()
  63.   gadets()
  64.   if slc == 0 then
  65.     print("There is none mission's setup!")
  66.   end
  67.   for i = 1, #things do
  68.     term.write("Number ")
  69.     term.setTextColor(colors.red)
  70.     print(i)
  71.     term.setTextColor(1)
  72.     term.write(" Todo = ")
  73.     term.setTextColor(colors.red)
  74.     print(things[i])
  75.     term.setTextColor(1)
  76.     term.write(" Time: ")
  77.     term.setTextColor(colors.red)
  78.     term.write(dates[i])
  79.     term.setTextColor(1)
  80.     term.write(" Made by ")
  81.     term.setTextColor(colors.red)
  82.     term.write(players[i])
  83.     term.setTextColor(1)
  84.     print(c)
  85.     print(c)
  86.   end
  87. end
  88.  
  89.  
  90. --Main Program
  91.  
  92. screen()
  93. gadets()
  94. print("There is none mission's setup!")
  95. while true do
  96.   event,button = os.pullEvent("key")
  97.   if button == keys.a then
  98.     slc = slc + 1
  99.     if slc < 5 then
  100.       add()
  101.     else    
  102.       screen()
  103.       print("You can not make more than 4 missions until next update!")
  104.       print(c)
  105.     end
  106.     printScreen()
  107.   elseif button == keys.c then
  108.     things = {}
  109.     dates = {}
  110.     players = {}
  111.     slc = 0
  112.     screen()
  113.     print("Deleting..")
  114.     sleep(2)
  115.     print("Deliting Complete!")
  116.     sleep(1)
  117.     screen()
  118.     print("There is none mission's setup!")
  119.     gadets()
  120.   elseif button == keys.h then
  121.     helpScreen()
  122.     eventtwo,buttontwo = os.pullEvent("key")
  123.     if buttontwo ~= 0 then
  124.       screen()
  125.       printScreen()
  126.     end
  127.   elseif button == keys.t then
  128.     break
  129.   else
  130.   end
  131.   sleep(.5)
  132. end
  133. screen()
  134. print("Program Ended!")
  135. sleep(1)
  136. screen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement