Advertisement
Guest User

startup

a guest
Aug 1st, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. --Functions
  2. function topTime()
  3.  while true do
  4.   term.setBackgroundColor(colors.lightBlue)
  5.   term.setCursorPos(11,2)
  6.   print(textutils.formatTime(os.time(),true))
  7.   sleep(0.1)
  8.  end
  9. end
  10.  
  11. function buttonToHomeSecurity()
  12.  startX = 2
  13.  startY = 4
  14.  endX = 16
  15.  endY = 6
  16.  paintutils.drawFilledBox(startX,startY,endX,endY,colors.green)
  17.  term.setCursorPos(startX + 1,startY + 1)
  18.  print("Home Security")
  19.  while true do
  20.   event, button, x, y = os.pullEvent("mouse_click")
  21.   if x > startX - 1 and y > startY - 1 and x < endX + 1 and y < endY + 1 and button == 1 then
  22.    paintutils.drawFilledBox(startX,startY,endX,endY,colors.red)
  23.    term.setCursorPos(startX + 1,startY + 1)
  24.    print("Home Security")
  25.    sleep(0.2)
  26.    term.setCursorPos(7,1)
  27.    print("Home Security")
  28.    paintutils.drawFilledBox(13,4,16,6)
  29.    parallel.waitForAll(buttonToOpenDoor)
  30.   end
  31.  end
  32. end
  33.  
  34. function buttonToOpenDoor()
  35.  startX = 2
  36.  startY = 4
  37.  endX = 12
  38.  endY = 6
  39.  paintutils.drawFilledBox(startX,startY,endX,endY,colors.green)
  40.  term.setCursorPos(startX + 1,startY + 1)
  41.  print("Open Door")
  42.  while true do
  43.   event, button, x, y = os.pullEvent("mouse_click")
  44.   if x > startX - 1 and y > startY - 1 and x < endX + 1 and y < endY + 1 and button == 1 then
  45.    paintutils.drawFilledBox(startX,startY,endX,endY,colors.red)
  46.    term.setCursorPos(startX + 1,startY + 1)
  47.    print("Open Door")
  48.    rednet.send("1337",8)
  49.   end
  50.  end
  51. end
  52.  
  53. --Code
  54. term.setBackgroundColor(colors.lightBlue)
  55. term.clear()
  56. term.setCursorPos(10,1)
  57. print("JardiOS")
  58. parallel.waitForAll(buttonToHomeSecurity,topTime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement