Mariomarco

Touch menue

Mar 31st, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. local monitor = peripheral.wrap("left")
  2. local count = 4
  3. term.write("Click to Stop")
  4. while(redstone.getInput("bottom") == false) do
  5.     monitor.setCursorPos(1,1)
  6.     monitor.write("Select the amount of MFSUs")
  7.     monitor.setCursorPos(1,2)
  8.     monitor.write("-       " .. count .. "       +")
  9.     monitor.setCursorPos(1,3)
  10.     monitor.write("")
  11.     monitor.setCursorPos(1,5)
  12.     monitor.write("        CRAFT!                        ")
  13.  
  14.  
  15.  
  16.     local event, side, xPos, yPos = os.pullEvent()
  17.  
  18.     if(event == "monitor_touch") then
  19.         if(yPos == 2 ) then
  20.             if(xPos < 8)then
  21.                 if(count > 1)then
  22.                     count = count - 1
  23.                 end
  24.             end
  25.         end
  26.         if(yPos == 2) then
  27.             if(xPos > 11)then
  28.                 if(count < 10)then
  29.                     count = count + 1
  30.                 end
  31.             end
  32.         end
  33.         if(yPos == 5) then
  34.             while(count > 1) do
  35.                 redstone.setOutput("back",true)
  36.                 sleep(1)
  37.                 redstone.setOutput("back",false)
  38.                 sleep(150)
  39.                 count = count - 1
  40.             end
  41.             redstone.setOutput("back",true)
  42.             sleep(1)
  43.             redstone.setOutput("back",false)
  44.         end
  45.         monitor.setTextScale(1)
  46.         monitor.clear()
  47.    
  48.     elseif(event == "mouse_click") then
  49.             term.clear()
  50.             term.setCursorPos(1,1)
  51.             term.write("XPOS:" .. xPos .. " YPOS:" .. yPos .. " SIDE:" .. side)
  52.             sleep(3)
  53.             return
  54.     end
  55.     sleep(0.01)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment