Advertisement
thatparadox

TchScrnKyPadNxus

Dec 10th, 2013
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. mon = peripheral.wrap("top")
  2. rednet.open("left")
  3. mon.setTextScale(5)
  4. linkTurtle = 21
  5. levels = 8 --put in your number of levels. this can be a variable.
  6.  
  7. function keyPad()
  8.     count = 0
  9.     mon.setTextScale(5)
  10.     mon.setBackgroundColour(colours.red)
  11.     mon.clear()
  12.     mon.setCursorPos(2,3)
  13.     mon.write("1 ")
  14.     mon.setCursorPos(5,3)
  15.     mon.write("2 ")
  16.     mon.setCursorPos(8,3)
  17.     mon.write("3 ")
  18.     mon.setCursorPos(2,5)
  19.     mon.write("4 ")
  20.     mon.setCursorPos(5,5)
  21.     mon.write("5 ")
  22.     mon.setCursorPos(8,5)
  23.     mon.write("6 ")
  24.     mon.setCursorPos(2,7)
  25.     mon.write("7 ")
  26.     mon.setCursorPos(5,7)
  27.     mon.write("8 ")
  28.     mon.setCursorPos(8,7)
  29.     mon.write("9 ")
  30.     mon.setCursorPos(3,8)
  31.     mon.write("Enter")
  32.     mon.setBackgroundColour(colours.black)
  33.     event, click, p1, p2 = os.pullEvent("monitor_touch")
  34.     if p1 >= 2 and p1 <=3 and p2 == 3 then
  35.         count = count + 1
  36.     end
  37.     event, click, p1, p2 = os.pullEvent("monitor_touch")
  38.     if p1 >= 8 and p1 <=9 and p2 == 7 then
  39.         count = count + 1
  40.     end
  41.     event, click, p1, p2 = os.pullEvent("monitor_touch")
  42.     if p1 >= 5 and p1 <=6 and p2 == 7 then
  43.         count = count + 1
  44.     end
  45.     if count ~= 3 then
  46.         pass = false
  47.     end
  48.     enter = false
  49.     while enter == false do
  50.         event, click, p1, p2 = os.pullEvent("monitor_touch")
  51.         if p2 == 8 then
  52.             enter = true
  53.         end
  54.     end
  55. end
  56.    
  57.  
  58. function display()
  59. x,y = mon.getSize()
  60. --mt = {}
  61. mon.setBackgroundColor(colors.black)
  62. mon.clear()
  63. mon.setTextColor(colours.black)
  64. mon.setTextScale(5)
  65. digi = levels
  66. p = 0
  67. for i = 1, levels, 2 do
  68.   p = p + 1
  69.   mon.setCursorPos(x/2-1,digi)
  70.   digi = digi - 1
  71.   mon.setBackgroundColor(colors.blue)
  72.   p = tostring(p)
  73.   mon.write(" "..p.." ")
  74.   p = tonumber(p)
  75.   p = p + 1
  76.   mon.setCursorPos(x/2,digi)
  77.   digi = digi - 1
  78.   mon.setBackgroundColor(colors.lightBlue)
  79.   p = tostring(p)
  80.   mon.write(" "..p.." ")
  81.   p = tonumber(p)
  82. end
  83. end
  84.  
  85. while true do
  86.   pass = true
  87.   display()
  88.   event, side, xPos, yPos = os.pullEvent("monitor_touch")
  89.   Floor = levels - yPos + 1
  90.   print(Floor)
  91.   if Floor == 1 then
  92.     mon.clear()
  93.     mon.setCursorPos(1,3)
  94.     mon.write("Empty your")
  95.     mon.setCursorPos(1,5)
  96.     mon.write("Inventory")
  97.     mon.setCursorPos(1,7)
  98.     mon.write("touch when")
  99.     mon.setCursorPos(4,8)
  100.     mon.write("ready")
  101.     wait = os.pullEvent()
  102.     keyPad()
  103.   end
  104.   if Floor > 0 and pass == true then
  105.     print("correct")
  106.     rednet.send(linkTurtle, Floor)
  107.   end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement