kd8lvt

Turtle - KdControl

Sep 11th, 2016
244
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)
  15. --2. Install this program
  16. --3. Install CCEnder, Touchpoint, and the Portable Computer program on your PDA.
  17. --4. Configure both devices to the same "channel" below
  18. --------CONFIGURATION--------
  19. channel = "put your uuid here"
  20. --------ACTUAL CODE--------
  21. os.loadAPI("ender")--Created by Sxw on the Computercraft Forums
  22. ender.connect(channel)
  23. function slot(num)
  24.   turtle.select(num)
  25. end
  26.  
  27. while true do
  28.   worked = false
  29.   while worked == false do
  30.     worked, command = ender.receive(channel)
  31.     sleep(0.1)
  32.   end
  33.   if command == "forward" then
  34.     turtle.forward()
  35.   elseif command == "left" then
  36.     turtle.turnLeft()
  37.   elseif command == "right" then
  38.     turtle.turnRight()
  39.   elseif command == "up" then
  40.     turtle.up()
  41.   elseif command == "down" then
  42.     turtle.down()
  43.   elseif command == "attack" then
  44.     turtle.attack()
  45.   elseif command == "mine" then
  46.     turtle.dig()
  47.   elseif command == "mine up" then
  48.     turtle.digUp()
  49.   elseif command == "mine down" then
  50.     turtle.digDown()
  51.   elseif command == "pair" then
  52.     --Ignore
  53.   elseif command == "select1" then
  54.     turtle.select(1)
  55.   elseif command == "select2" then
  56.     turtle.select(2)
  57.   elseif command == "select3" then
  58.     turtle.select(3)
  59.   elseif command == "select4" then
  60.     turtle.select(4)
  61.   elseif command == "select5" then
  62.     turtle.select(5)
  63.   elseif command == "select6" then
  64.     turtle.select(6)
  65.   elseif command == "select7" then
  66.     turtle.select(7)
  67.   elseif command == "select8" then
  68.     turtle.select(8)
  69.   elseif command == "select9" then
  70.     turtle.select(9)
  71.   elseif command == "select10" then
  72.     turtle.select(10)
  73.   elseif command == "select11" then
  74.     turtle.select(11)
  75.   elseif command == "select12" then
  76.     turtle.select(12)
  77.   elseif command == "select13" then
  78.     turtle.select(13)
  79.   elseif command == "select14" then
  80.     turtle.select(14)
  81.   elseif command == "select15" then
  82.     turtle.select(15)
  83.   elseif command == "select16" then
  84.        turtle.select(16)
  85.   elseif command == "place" then
  86.     turtle.place()
  87.   elseif command == "place up" then
  88.     turtle.placeUp()
  89.   elseif command == "place down" then
  90.     turtle.placeDown()
  91.   else
  92.     print("Unknown Command: "..command)
  93.   end
  94. end
RAW Paste Data