Advertisement
psychedelixx

Minecraft Turtle: Top Platform

Feb 5th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.         Minecraft Turtle: Top Platform
  3.         2013 (c) psychedelixx
  4.         2013-12-15
  5.  
  6.         Builds a simple platform
  7.  
  8.         Usage:
  9.         - use turtle and type "label set <name>"
  10.           (to give your turtle an unique name so it remembers its programs)
  11.         - type "pastebin get 5cuDGCK7 topPlatform"
  12. --]]
  13.  
  14. dirCounter = 1
  15. width = 2
  16. length = 2
  17.  
  18. --[[ --- Parameter ---- ]]--
  19. local args = { ... }
  20.  
  21. if #args == 1 then
  22.     width  = tonumber(args[1])
  23.     length = width
  24. end
  25.  
  26. if #args == 2 then
  27.     width  = tonumber(args[1])
  28.     length = tonumber(args[2])
  29. end
  30.  
  31. if width*length > 1024 then
  32.     print("max size: 1024 (32*32)")
  33. end
  34.  
  35. if turtle.getFuelLevel() < width * length then
  36.     turtle.refuel()
  37. end
  38.                    
  39. if turtle.getFuelLevel() < width * length then
  40.     print("Amount of missing fuel: ", width * length - turtle.getFuelLevel())
  41.     print("Missing fuel in coal: ", (width * length - turtle.getFuelLevel())/80+1)
  42. end
  43.  
  44. sumItems = 0
  45. for i=1, 16, 1 do
  46.     sumItems = sumItems + turtle.getItemCount(i)
  47. end        
  48.  
  49.     print("Not enough Resources")
  50.     print("Press enter to continue")
  51.     read()
  52.  
  53.     print("======== 2013 (c) psychedelixx ========")
  54.     print("=========== Platform Builder ==========")
  55.    
  56.  
  57.     slot = 1
  58.  
  59.     for w=1, width, 1 do
  60.     for l=1, length, 1 do
  61.         while turtle.getItemCount(slot) == 0 and slot < 16 do
  62.             slot = slot + 1
  63.         end
  64.         if turtle.getItemCount(slot) == 0 and slot == 16 then
  65.             print("No more ressources... Fill me up and press enter")
  66.         read()
  67.             slot = 1
  68.         end
  69.             turtle.select(slot)
  70.  
  71.             turtle.digUp()
  72.             turtle.placeUp()
  73.         if l < length then
  74.                 turtle.dig()
  75.             turtle.forward()
  76.         end
  77.     end
  78.  
  79.     if w < width then
  80.             if dirCounter%2 == 1 then
  81.                 turtle.turnRight()
  82.             turtle.forward()
  83.             turtle.turnRight()
  84.         else
  85.             turtle.turnLeft()
  86.             turtle.forward()
  87.             turtle.turnLeft()
  88.         end
  89.         else
  90.             if dirCounter%2 == 1 then
  91.                 turtle.turnRight()
  92.             turtle.turnRight()
  93.         for l=1, length-1, 1 do
  94.                 turtle.forward()
  95.                 end
  96.         end
  97.         turtle.turnRight()
  98.  
  99.         for w=1, width-1, 1 do
  100.             turtle.forward()
  101.             end
  102.     end
  103.     dirCounter = dirCounter + 1
  104.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement