Guest User

startup

a guest
Sep 11th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.23 KB | None | 0 0
  1. os.loadAPI("ender")
  2. os.loadAPI("touchpoint")
  3. main = touchpoint.new()
  4. inv = touchpoint.new()
  5. local t
  6. function mainMenu()
  7.   t = main
  8. end
  9.  
  10. function invMenu()
  11.   t = inv
  12. end
  13.  
  14. function tellTurtle(command)
  15.   ender.send("kd8lvtTurtle",command)
  16. end
  17. --Main Movement/Digging--
  18.   main:add("^",function() tellTurtle("forward") end,10,2,12,3,colors.green,colors.lime)
  19.   main:add("<",function() tellTurtle("left") end,8,5,10,6,colors.green,colors.lime)
  20.   main:add(">",function() tellTurtle("right") end,12,5,14,6,colors.green,colors.lime)
  21.   main:add("Up",function() tellTurtle("up") end,20,2,25,3,colors.green,colors.lime)
  22.   main:add("Down",function() tellTurtle("down") end,20,6,25,7,colors.green,colors.lime)
  23.   main:add("Attack",function() tellTurtle("attack") end,2,12,10,13,colors.green,colors.lime)
  24.   main:add("Mine",function() tellTurtle("mine") end,2,15,10,16,colors.green,colors.lime)
  25.   main:add("Mine Up",function() tellTurtle("mine up") end,12,15,20,16,colors.green,colors.lime)
  26.   main:add("Mine Down",function() tellTurtle("mine down") end,2,18,20,19,colors.green,colors.lime)
  27.   main:add("Inv.",function() invMenu() end,12,12,20,13,colors.green,colors.lime)
  28. --Inventory--
  29.   inv:add("1",function() tellTurtle("select1") end,2,2,4,5,colors.green,colors.lime)
  30.   inv:add("2",function() tellTurtle("select2") end,5,2,8,5,colors.green,colors.lime)
  31.   inv:add("3",function() tellTurtle("select3") end,9,2,12,5,colors.green,colors.lime)
  32.   inv:add("4",function() tellTurtle("select4") end,13,2,16,5,colors.green,colors.lime)
  33.   inv:add("5",function() tellTurtle("select5") end,2,6,4,8,colors.green,colors.lime)
  34.   inv:add("6",function() tellTurtle("select6") end,5,6,8,8,colors.green,colors.lime)
  35.   inv:add("7",function() tellTurtle("select7") end,9,6,12,8,colors.green,colors.lime)
  36.   inv:add("8",function() tellTurtle("select8") end,13,6,16,8,colors.green,colors.lime)
  37.   inv:add("9",function() tellTurtle("select9") end,2,9,5,11,colors.green,colors.lime)
  38.   inv:add("10",function() tellTurtle("select10") end,6,9,9,11,colors.green,colors.lime)
  39.   inv:add("11",function() tellTurtle("select11") end,10,9,13,11,colors.green,colors.lime)
  40.   inv:add("12",function() tellTurtle("select12") end,14,9,17,11,colors.green,colors.lime)
  41.   inv:add("13",function() tellTurtle("select13") end,2,12,5,12,colors.green,colors.lime)
  42.   inv:add("14",function() tellTurtle("select14") end,6,12,9,12,colors.green,colors.lime)
  43.   inv:add("15",function() tellTurtle("select15") end,10,12,13,12,colors.green,colors.lime)
  44.   inv:add("16",function() tellTurtle("select16") end,14,12,17,12,colors.green,colors.lime)
  45.   inv:add("Place",function() tellTurtle("place") end,2,14,25,15,colors.green,colors.lime)
  46.   inv:add("Place Up",function() tellTurtle("place up") end,2,17,13,19,colors.green,colors.lime)
  47.   inv:add("Place Down",function() tellTurtle("place down") end,15,17,25,19,colors.green,colors.lime)  
  48.   inv:add("Main",function() mainMenu() end,18,2,23,4,colors.green,colors.lime)
  49. mainMenu()
  50. while true do
  51.   t:draw()
  52.   -- local event, p1, p2, p3 = os.pullEvent() ---monitor_touch, side, xpos, ypos
  53.   local event, p1 = t:handleEvents(os.pullEvent()) --button_click, name
  54.   if event == "button_click" then
  55.     --Remove toggling and simplify button running
  56.     t.buttonList[p1].func()
  57.   end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment