Guest User

combo

a guest
Oct 27th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. mouseWidth = 0
  2. mouseHeight = 0
  3.  
  4. local monitor_1 = peripheral.wrap("right")
  5. local monitor_2 = peripheral.wrap("left")
  6.  
  7. monitor_1.clear()
  8. monitor_2.clear()
  9.  
  10. monitor_1.setCursorPos(1,1)
  11. monitor_2.setCursorPos(1,1)
  12.  
  13. w_1, h_1 = monitor_1.getSize()
  14. w_2, h_2 = monitor_2.getSize()
  15.  
  16. print(w_1)
  17. print(h_1)
  18.  
  19. monitor_1.setBackgroundColor((colors.lime))
  20. monitor_2.setBackgroundColor((colors.lime))
  21.  
  22. --width, 18; height, 12
  23.  
  24. monitor_1.setCursorPos(3,2)
  25. monitor_2.setCursorPos(3,2)
  26.  
  27. monitor_1.write(" Combination: ")
  28. monitor_2.write(" Combination: ")
  29.  
  30. monitor_1.setCursorPos(2,6)
  31. monitor_2.setCursorPos(2,6)
  32.  
  33. monitor_1.write("  1  ")
  34. monitor_2.write("  1  ")
  35.  
  36. monitor_1.setCursorPos(13,6)
  37. monitor_2.setCursorPos(13,6)
  38.  
  39. monitor_1.write("  2  ")
  40. monitor_2.write("  2  ")
  41.  
  42. monitor_1.setCursorPos(2,10)
  43. monitor_2.setCursorPos(2,10)
  44.  
  45. monitor_1.write("  3  ")
  46. monitor_2.write("  3  ")
  47.  
  48. monitor_1.setCursorPos(13,10)
  49. monitor_2.setCursorPos(13,10)
  50.  
  51. monitor_1.write("  4  ")
  52. monitor_2.write("  4  ")
  53.  
  54. monitor_1.setBackgroundColor((colors.black))
  55. monitor_2.setBackgroundColor((colors.black))
  56.  
  57. local counter = 0
  58.  
  59. function c3()
  60. repeat
  61.   event, p1,p2,p3 = os.pullEvent()
  62.  
  63.   if(event == "monitor_touch") then
  64.     w_1 = p2
  65.     h_1 = p3
  66.     if(w_1 > 12 and w_1 < 18 and h_1 == 10) then
  67.       rs.setOutput("back", true)
  68.       sleep(1)
  69.       rs.setOutput("back", false)
  70.       counter = counter + 1
  71.       main()
  72.     else
  73.       main()
  74.     end
  75.   end
  76. until (event == "char" and p1 == ("x"))
  77. end
  78.  
  79. function c2()
  80. repeat
  81.   event,p1,p2,p3 = os.pullEvent()
  82.  
  83.   if(event == "monitor_touch") then
  84.     w_1 = p2
  85.     h_1 = p3
  86.     if(w_1 > 1 and w_1 < 7 and h_1 == 10) then
  87.       c3()
  88.     else
  89.       main()
  90.     end
  91.   end
  92. until(event == "char" and p1 == ("x"))
  93. end
  94.  
  95. function c1()
  96. repeat
  97.   event,p1,p2,p3 = os.pullEvent()
  98.  
  99.   if(event == "monitor_touch") then
  100.     w_1 = p2
  101.     h_1 = p3
  102.     if(w_1 > 12 and w_1 < 18 and h_1 == 6) then
  103.       c2()
  104.     else
  105.       main()
  106.     end
  107.   end
  108. until(event == "char" and p1 == ("x"))
  109. end
  110.  
  111. function main()
  112. repeat
  113.   event,p1,p2,p3 = os.pullEvent()
  114.  
  115.   if (event == "monitor_touch") then
  116.     w_1 = p2
  117.     h_1 = p3
  118.     if(w_1 > 1 and w_1 < 7 and h_1 == 6) then
  119.       c1()
  120.     else
  121.       main()    
  122.     end
  123.   end
  124. until(event == "char" and p1 == ("x"))
  125. end
  126.  
  127. main()
Advertisement
Add Comment
Please, Sign In to add comment