Advertisement
Guest User

f

a guest
Apr 23rd, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. os.sleep(1)
  2. local mon = peripheral.wrap("top")
  3. mon.clear()
  4. rednet.open("back")
  5. mon.setTextColor(colors.purple)
  6. mon.setCursorPos(3,1)
  7. mon.write("***TERMINAL***")
  8. mon.setCursorPos(1,12)
  9. mon.write("Dotykova obrazovka")
  10. mon.setTextColor(colors.red)
  11. ----------------------------------------------------------------------------
  12.  
  13. zmacknuto=false
  14.  
  15. text="fermenter"
  16.  
  17.  
  18. mon.setCursorPos(5,3)
  19. mon.write(text)
  20.  
  21. function klik(kx,ky)
  22.   if ky==3 and ( kx > 4 and kx < 15) or zmacknut==true then
  23.     print("zmena fermenter")
  24.     zmacknuto = not zmacknuto
  25.     if zmacknuto == true or zmacknut==true then
  26.       mon.setTextColor(colors.lime)
  27.           rednet.send(244, "turtle1on")
  28.     else
  29.       mon.setTextColor(colors.red)
  30.           rednet.send(244, "turtle1off")
  31.     end
  32.     mon.setCursorPos(5,3)
  33.     mon.write(text)
  34.   end
  35. end
  36. ----------------------------------------
  37. zmacknuto1=false
  38.  
  39. text1="farma na drevo"
  40.  
  41. mon.setCursorPos(3,4)
  42. mon.write(text1)
  43.  
  44. function klik1(kx,ky)
  45.   if ky==4 and ( kx > 2 and kx < 16) then
  46.     print("zmena farma")
  47.     zmacknuto1 = not zmacknuto1
  48.     if zmacknuto1 == true then
  49.       mon.setTextColor(colors.lime)
  50.           rednet.send(203, "turtle2on")
  51.     else
  52.       mon.setTextColor(colors.red)
  53.           rednet.send(203, "turtle2off")
  54.     end
  55.     mon.setCursorPos(3,4)
  56.     mon.write(text1)
  57.   end
  58. end
  59. ----------------------------------------
  60. zmacknuto2=false
  61.  
  62. text2="vyroba ethanolu"
  63. mon.setTextColor(colors.red)
  64.  
  65.  
  66. mon.setCursorPos(3,5)
  67. mon.write(text2)
  68.  
  69. function klik2(kx,ky)
  70.   if ky==5 and ( kx > 2 and kx < 16) then
  71.     print("zmena ethanol")
  72.     zmacknuto2 = not zmacknuto2
  73.     if zmacknuto2 == true then
  74.       mon.setTextColor(colors.lime)
  75.       zmacknut=true
  76.       rednet.send(203, "turtle3on")
  77.       mon.setCursorPos(2,11)
  78.       mon.setTextColor(colors.red)
  79.       mon.write("vynucen fermenter")
  80.       mon.setTextColor(colors.lime)
  81.       else
  82.       mon.setCursorPos(1,11)
  83.       mon.clearLine()
  84.       mon.setTextColor(colors.red)
  85.           rednet.send(203, "turtle3off")
  86.     zmacknut=false
  87.     end
  88.     mon.setCursorPos(3,5)
  89.     mon.write(text2)
  90.   end
  91. end
  92.  
  93. ----------------------------------------
  94. while true do
  95.   mon.setBackgroundColor(colors.black)
  96.    local e,s,x,y = os.pullEvent("monitor_touch")
  97.   klik1(x,y)
  98.   klik2(x,y)
  99.   klik(x,y)
  100.   print(x..":"..y)
  101.   sleep(0.1)
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement