Advertisement
sjones321

orionp

Mar 27th, 2012
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.87 KB | None | 0 0
  1. local tArgs = { ... }
  2. local command = tArgs[1]
  3. local p1 = tArgs[2]
  4. local p2 = tArgs[3]
  5. local p3 = tArgs[4]
  6. local p4 = tArgs[5]
  7. -- Move in a direction --
  8. if (command == "up") then
  9.     orion.up(p1)
  10. elseif (command == "down") then
  11.     orion.down(p1)
  12. elseif (command == "turnleft") then
  13.     orion.turnLeft()
  14. elseif (command == "turnright") then
  15.     orion.turnRight()
  16. elseif (command == "forward") then
  17.     orion.forward(p1)
  18. elseif (command == "back") then
  19.     orion.back(p1)
  20. elseif (command == "left") then
  21.     orion.goLeft(p1)
  22. elseif (command == "right") then
  23.     orion.goRight(p1)
  24.  
  25. --Go in a cardinal direction --
  26. elseif (command == "go") then
  27.     if (p1 == "north") then
  28.         orion.goNorth()
  29.     elseif (p1 == "south") then
  30.         orion.goSouth()
  31.     elseif (p1 == "west") then
  32.         orion.goWest()
  33.     elseif (p1 == "east") then
  34.         orion.goEast()
  35.     elseif (p1 == "up") then
  36.         orion.goUp()
  37.     elseif (p1 == "down") then
  38.         orion.goDown()
  39.     end
  40. -- face a cardinal direction --
  41. elseif (command == "face") then
  42.     if (p1 == "west") then
  43.         orion.faceWest()
  44.     elseif (p1 == "east") then
  45.         orion.faceEast()
  46.     elseif (p1 == "south") then
  47.         orion.faceSouth()
  48.     elseif (p1 == "north") then
  49.         orion.faceNorth()
  50.     elseif (p1 == "back") then
  51.         orion.faceBack()
  52.     end
  53.    
  54. -- Set current facing as north --
  55. elseif (command == "setnorth") then
  56.     orion.setNorth()
  57.    
  58. -- Set current position as x, y, z, facing in number south being 0 west being 3 --
  59. elseif (command == "setpos") then
  60.     if (p1 and p2 and p3 and not p4) then
  61.         orion.setPos(p1,p2,p3)
  62.         orion.setNorth()
  63.     elseif (p1 and p2 and p3 and p4) then
  64.         orion.setPos(p1,p2,p3,p4)
  65.     else
  66.         print("Need to give all three coordinates, and make sure the computer is facing North or give facing too.")
  67.     end
  68.    
  69. -- Set the desired drop location as x, y, z
  70. elseif (command == "setdrop") then
  71.     if (p1 and p2 and p3 and not p4) then
  72.         orion.setDrop(p1,p2,p3)
  73.     else
  74.         print("Need to give all three coordinates.")
  75.     end
  76.  
  77. -- Print the current drop location --
  78. elseif (command == "getdrop") then
  79.     local theDrop = orion.getDrop()
  80.     if (theDrop) then
  81.         theDrop = orion.seperate(theDrop,",")
  82.         print("x: "..theDrop[1]..", y: "..theDrop[2]..", z: "..theDrop[3])
  83.     end
  84.    
  85. -- Print the current location --
  86. elseif (command == "getpos") then
  87.     local thePos = { orion.getPos() }
  88.     thePos[4] = orion.getFacing()
  89.     print("x: "..thePos[1]..", y: "..thePos[2]..", z: "..thePos[3])
  90.     print("Facing: "..thePos[4])
  91. elseif (command == "getfilepos") then
  92.     local theX,theY,theZ,theFace = orion.getFilePos()
  93.     if (theX) then
  94.         orion.setPos(theX,theY,theZ,theFace)
  95.     end
  96. elseif (command == "showpos") then
  97.     orion.showPos()
  98. elseif (command == "savepos") then
  99.     orion.savePos()
  100.  
  101. -- Tell turtle to go to a location using collision detection --
  102. elseif (command == "newgoto") then
  103.     if (p1 and p2 and p3) then
  104.         orion.newGoto(p1,p2,p3)
  105.     else
  106.         print("Need to give all three coordinates.")
  107.     end
  108.    
  109. -- Tell turtle to go to a location digging its way there --
  110. elseif (command == "diggoto") then
  111.     if (p1 and p2 and p3) then
  112.         orion.goToPos(p1,p2,p3,true)
  113.     else
  114.         print("Need to give all three coordinates, and have current coordinates & direction set beforehand.")
  115.     end
  116.  
  117. elseif (command == "goto") then
  118.     if (p1 and p2 and p3) then
  119.         orion.goToPos(p1,p2,p3)
  120.     else
  121.         print("Need to give all three coordinates, and have current coordinates & direction set beforehand.")
  122.     end
  123. elseif (command == "dirmgoto") then
  124.     -- Do something
  125. elseif (command == "dirgoto") then
  126.     -- Do something
  127.    
  128. -- Dig a room from top left corner down in format depth/height, length, width --
  129. elseif (command == "smartdig") then
  130.     if (p1 and not p4) then
  131.         orion.smartDig(p1,p2,p3)
  132.     elseif (p1 and p4) then
  133.         orion.smartDig(p1,p2,p3,p4)
  134.     else
  135.         print("Need to give at least one value.")
  136.     end
  137.    
  138. -- Build a house using automated refilling station --
  139. elseif (command == "build") then
  140.     orion.readBuild()
  141. else
  142.     print("Enter a command.")
  143. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement