Advertisement
Guest User

inventory

a guest
May 24th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. os.loadAPI("touchpoint")
  2.  
  3. --FINESTRES------------------------
  4. mprin = touchpoint.new("monitor_1")
  5. mcasc = touchpoint.new("monitor_1")
  6. --PERIFERICS-----------------------
  7. pim = peripheral.wrap("pim_0")
  8. --MENU PRINCIPAL-------------------
  9. mprin:add("Casc",nil, 2,2,14,5, colors.blue, colors.lime)
  10. --MENU CASC------------------------
  11. mcasc:add("Equipar ulleres",nil, 2,2,28,4, colors.orange, colors.blue)
  12. mcasc:add("Equipar casc",nil,2,5,28,7, colors.orange, colors.blue)
  13. mcasc:add("Menu principal", nil,2,8,28,10, colors.red, colors.orange)
  14.  
  15. --FUNCIONS-------------------------
  16. function eulleres()
  17.   pim.pushItemIntoSlot("west",40,1,2)
  18.   pim.pullItemIntoSlot("west",1,1,40)
  19. end
  20.  
  21. function ecasc()
  22.   pim.pushItemIntoSlot("west",40,1,1)
  23.   pim.pullItemIntoSlot("west",2,1,40)
  24. end
  25. --PROGRAMA PRINCIPAL----------------
  26. while true do
  27.   mprin:draw()
  28.   local event, p1 = mprin:handleEvents(os.pullEvent())
  29.  
  30.  
  31.   if event == "button_click" and p1 == "Casc" then
  32.     mcasc:draw()
  33.     while true do
  34.       local event, p1 = mcasc:handleEvents(os.pullEvent())
  35.       if event == "button_click" and p1 == "Equipar ulleres" then
  36.         mcasc:flash("Equipar ulleres")
  37.         eulleres()
  38.       elseif event == "button_click" and p1 == "Equipar casc" then
  39.         mcasc:flash("Equipar casc")
  40.         ecasc()
  41.       elseif event == "button_click" and p1 == "Menu principal" then
  42.         mcasc:flash("Menu principal")
  43.         break    
  44.       end
  45.     end
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement