Advertisement
kd8lvt

PDA - KdControl

Sep 11th, 2016
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Version 0.0.2
  2. --------LISCENCE--------
  3. --This code is owned by kd8lvt, and all APIs are owned by their respective creators, listed next to their 'os.loadAPI'-s
  4. --This code is liscensed under a custom liscence that is as follows:
  5. --You may:
  6. --  1.Look at and use portions of the code, with credit.
  7. --  2.Learn from this code
  8. --  3.Include this code in your "Computecraft OS", with credit, and without modification.
  9. --You may NOT:
  10. --  1.Claim this code as your own
  11. --  2.Re-host this code (use the original pastebin!)
  12. --  3.Put this code behind a adwall/paywall (ad.fly etc)
  13. --------HOW TO INSTALL--------
  14. --1. Install the APIs (they are on the ComputerCraft forums in the APIs section as CCEnder and Touchpoint)
  15. --2. Install this program
  16. --3. Install CCEnder and the turtle program on your turtle that has a pickaxe and a sword.
  17. --4. Configure both devices to the same "channel" in the below "CONFIGURATION" section
  18. --------CONFIGURATION--------
  19. channel = "put your uuid here"
  20. --------ACTUAL CODE--------
  21. os.loadAPI("ender") --Created by Sxw on the Computercraft Forums
  22. os.loadAPI("touchpoint") --Created by Lyqyd on the Computercraft Forums
  23. main = touchpoint.new()
  24. inv = touchpoint.new()
  25. local t
  26. function mainMenu()
  27.   t = main
  28. end
  29.  
  30. function invMenu()
  31.   t = inv
  32. end
  33.  
  34. function tellTurtle(command)
  35.   ender.send(channel,command)
  36. end
  37. --Main Movement/Digging--
  38.   main:add("^",function() tellTurtle("forward") end,10,2,12,3,colors.green,colors.lime)
  39.   main:add("<",function() tellTurtle("left") end,8,5,10,6,colors.green,colors.lime)
  40.   main:add(">",function() tellTurtle("right") end,12,5,14,6,colors.green,colors.lime)
  41.   main:add("Up",function() tellTurtle("up") end,20,2,25,3,colors.green,colors.lime)
  42.   main:add("Down",function() tellTurtle("down") end,20,6,25,7,colors.green,colors.lime)
  43.   main:add("Attack",function() tellTurtle("attack") end,2,12,10,13,colors.green,colors.lime)
  44.   main:add("Mine",function() tellTurtle("mine") end,2,15,10,16,colors.green,colors.lime)
  45.   main:add("Mine Up",function() tellTurtle("mine up") end,12,15,20,16,colors.green,colors.lime)
  46.   main:add("Mine Down",function() tellTurtle("mine down") end,2,18,20,19,colors.green,colors.lime)
  47.   main:add("Inv.",function() invMenu() end,12,12,20,13,colors.green,colors.lime)
  48. --Inventory--
  49.   inv:add("1",function() tellTurtle("select1") end,1,2,4,5,colors.green,colors.lime)
  50.   inv:add("2",function() tellTurtle("select2") end,5,2,8,5,colors.green,colors.lime)
  51.   inv:add("3",function() tellTurtle("select3") end,9,2,12,5,colors.green,colors.lime)
  52.   inv:add("4",function() tellTurtle("select4") end,13,2,16,5,colors.green,colors.lime)
  53.   inv:add("5",function() tellTurtle("select5") end,1,6,4,8,colors.green,colors.lime)
  54.   inv:add("6",function() tellTurtle("select6") end,5,6,8,8,colors.green,colors.lime)
  55.   inv:add("7",function() tellTurtle("select7") end,9,6,12,8,colors.green,colors.lime)
  56.   inv:add("8",function() tellTurtle("select8") end,13,6,16,8,colors.green,colors.lime)
  57.   inv:add("9",function() tellTurtle("select9") end,1,9,5,11,colors.green,colors.lime)
  58.   inv:add("10",function() tellTurtle("select10") end,6,9,9,11,colors.green,colors.lime)
  59.   inv:add("11",function() tellTurtle("select11") end,10,9,13,11,colors.green,colors.lime)
  60.   inv:add("12",function() tellTurtle("select12") end,14,9,17,11,colors.green,colors.lime)
  61.   inv:add("13",function() tellTurtle("select13") end,1,12,4,12,colors.green,colors.lime)
  62.   inv:add("14",function() tellTurtle("select14") end,5,12,8,12,colors.green,colors.lime)
  63.   inv:add("15",function() tellTurtle("select15") end,9,12,12,12,colors.green,colors.lime)
  64.   inv:add("16",function() tellTurtle("select16") end,13,12,16,12,colors.green,colors.lime)
  65.   inv:add("Place",function() tellTurtle("place") end,1,14,25,15,colors.green,colors.lime)
  66.   inv:add("Place Up",function() tellTurtle("place up") end,1,17,12,19,colors.green,colors.lime)
  67.   inv:add("Place Down",function() tellTurtle("place down") end,14,17,25,19,colors.green,colors.lime)  
  68.   inv:add("Main",function() mainMenu() end,18,2,23,4,colors.green,colors.lime)
  69. mainMenu()
  70. while true do
  71.   t:draw()
  72.   local event, p1 = t:handleEvents(os.pullEvent())
  73.   if event == "button_click" then
  74.     t.buttonList[p1].func()
  75.   end
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement