Advertisement
Bollie

Stairs

Apr 3rd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. -- http://pastebin.com/xeEEDU4T
  2. -- http://pastebin.com/u/Bollie
  3. os.loadAPI("p") -- http://pastebin.com/SGcYmCqd
  4. os.loadAPI("t") -- http://pastebin.com/6vxbgdjX
  5.  
  6. -- READ PARAMETERS
  7. local args = { ... }
  8.  
  9. -- CHECK SLOTS AND PARAMETERS
  10. local argsOK = true
  11.  
  12. if #args < 1 then
  13.  argsOK = false
  14. else
  15.  -- read length
  16.  mylength = math.floor(tonumber(args[1]) or 1)
  17. end
  18.  
  19. placeChairs = false
  20. if (t.getItemCount(16) > 0) then
  21.  placeChairs = true
  22. end
  23.  
  24. if argsOK == false then
  25.  print("usage: stairs <length>")
  26.  print("put chairs in slot 16")
  27.  return
  28. end
  29. -- END PARAMETERS
  30.  
  31. -- xxxxxxxxx
  32. -- xxxxx. <= . will be digged (1 up 3 down)
  33. -- xxxx..t <= start
  34. -- xxx...
  35. -- xx....
  36. -- x.....xxx
  37. -- .....xxxx
  38. -- x...xxxxx
  39.  
  40. for d = 1, mylength do
  41.  t.digAndForward()
  42.  t.digUp()
  43.  t.digAndDown()
  44.  t.digAndDown()
  45.  t.digDown()
  46.  t.digAndUp()
  47. end
  48.  
  49. -- return
  50. t.turn()
  51. t.digAndDown()
  52.  
  53. t.select(16)
  54. for d = 1, mylength do
  55.  if placeChairs == true then
  56.   t.placeDown()
  57.  end
  58.  t.digAndUp()
  59.  t.digAndForward()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement