Advertisement
NixillUmbreon

Untitled

Sep 14th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. shell = require("shell")
  2. comp = require("component")
  3. w = comp.debug.getWorld()
  4. a = shell.parse(...)
  5.  
  6. function quit(msg)
  7. print(msg)
  8. a = 0 / 0
  9. end
  10.  
  11. requirements = (#a > 6 and #a % 2 == 0)
  12. if not requirements then quit("Usage: <x> <y> <z> <x> <y> <z> <id1> <data1> [<id2> <data2>...]") end
  13. x1 = tonumber(a[1])
  14. y1 = tonumber(a[2])
  15. z1 = tonumber(a[3])
  16. x2 = tonumber(a[4])
  17. y2 = tonumber(a[5])
  18. z2 = tonumber(a[6])
  19. if not (x1 and y1 and z1 and x2 and y2 and z2) then quit("All coords must be numeric") end
  20. blocks = {}
  21. for b = 7, #a, 2 do
  22. block = {id = tonumber(a[b]), data = tonumber(a[b+1])}
  23. if not block.data then block.data = 0 end
  24. if not block.id then quit("All numbers required") end
  25. blocks[#blocks+1] = block
  26. print("{id=" .. block.id .. ", data=" .. block.data .. "}")
  27. end
  28.  
  29. if x2 < x1 then x1, x2 = x2, x1 print(x1 .. " " .. x2) end
  30. if y2 < y1 then y1, y2 = y2, y1 print(y1 .. " " .. y2) end
  31. if z2 < z1 then z1, z2 = z2, z1 print(z1 .. " " .. z2) end
  32.  
  33. blockN = -1
  34. for x = x1, x2 do
  35. for z = z1, z2 do
  36. for y = y1, y2 do
  37. os.sleep(0)
  38.  
  39. blockN = (blockN + 1) % #blocks
  40. block = blocks[blockN + 1]
  41. w.setBlock(x, y, z, block.id, block.data)
  42. end
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement