Advertisement
Aradoexis

lift.lua

Nov 12th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. term.clear()
  2. monitor=peripheral.wrap("top")
  3.  
  4. function numberOnScreen()
  5.     monitor.clear()
  6.     monitor.setCursorPos(1,1)
  7.     monitor.write("[0]|[1]")
  8.     monitor.setCursorPos(1,2)
  9.     monitor.write("[2]|[3]")
  10.     monitor.setCursorPos(1,3)
  11.     --monitor.write("[4]|[5]")
  12.     monitor.setCursorPos(1,4)
  13.     --monitor.write("[6]|[7]")
  14.     monitor.setCursorPos(1,5)
  15.     --monitor.write("[8]|[9]")
  16. end
  17.  
  18. function touchPosScanner()
  19. t=2
  20. while true do
  21.     event, side, x, y = os.pullEvent("monitor_touch")
  22.     --[0] pushed
  23.     if(y==1 and (x==1 or x==2 or x==3)) then
  24.         rs.setBundledOutput("back",colors.white)
  25.         sleep(t)
  26.         rs.setBundledOutput("back",0)
  27.     end
  28.     --[1] pushed
  29.     if(y==1 and (x==4 or x==5 or x==6)) then
  30.         rs.setBundledOutput("back",colors.green)
  31.         sleep(t)
  32.         rs.setBundledOutput("back",0)
  33.     end
  34.     --[2] pushed
  35.     if(y==2 and (x==1 or x==2 or x==3)) then
  36.         rs.setBundledOutput("back",colors.red)
  37.         sleep(t)
  38.         rs.setBundledOutput("back",0)
  39.     end
  40.     --[3] pushed
  41.     if(y==2 and (x==4 or x==5 or x==6)) then
  42.         rs.setBundledOutput("back",colors.pink)
  43.         sleep(t)
  44.         rs.setBundledOutput("back",0)
  45.     end
  46. end
  47. end
  48. numberOnScreen()
  49. touchPosScanner()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement