Advertisement
BombBloke

Barrel Identifier (OpenPeripheral)

Jan 24th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.78 KB | None | 0 0
  1. local x,y,z = 239,427,58
  2.  
  3. local stringThing = {}
  4.  
  5. local count = 1
  6.  
  7. for i=1,32 do
  8.     local thisBarrel = peripheral.wrap("front")
  9.    
  10.     local thisSlot = thisBarrel.getStackInSlot(1)
  11.    
  12.     if thisSlot then
  13.         stringThing[count] = "[\""..thisSlot.name.." ("..thisSlot.id..":"..thisSlot.dmg..")\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  14.     else
  15.         stringThing[count] = "[\"Unused\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  16.     end
  17.    
  18.     if i<32 then
  19.         while not turtle.turnRight() do end
  20.         while not turtle.forward() do end
  21.         while not turtle.turnLeft() do end
  22.         x=x-1
  23.     end
  24.    
  25.     count = count+1
  26. end
  27.  
  28.  
  29. while not turtle.back() do end
  30. turtle.up()
  31. turtle.up()
  32. while not turtle.forward() do end
  33.  
  34. z=60
  35. sleep(1)
  36. for i=1,32 do
  37.     local thisBarrel = peripheral.wrap("front")
  38.    
  39.     local thisSlot = thisBarrel.getStackInSlot(1)
  40.    
  41.     if thisSlot then
  42.         stringThing[count] = "[\""..thisSlot.name.." ("..thisSlot.id..":"..thisSlot.dmg..")\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  43.     else
  44.         stringThing[count] = "[\"Unused\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  45.     end
  46.    
  47.     if i<32 then
  48.         while not turtle.turnLeft() do end
  49.         while not turtle.forward() do end
  50.         while not turtle.turnRight() do end
  51.         x=x+1
  52.     end
  53.    
  54.     count = count+1
  55. end
  56.  
  57. while not turtle.turnLeft() do end
  58. while not turtle.turnLeft() do end
  59. while turtle.forward() do end
  60.  
  61. x,y,z = 239,420,60
  62. sleep(1)
  63. for i=1,32 do
  64.     local thisBarrel = peripheral.wrap("front")
  65.    
  66.     local thisSlot = thisBarrel.getStackInSlot(1)
  67.    
  68.     if thisSlot then
  69.         stringThing[count] = "[\""..thisSlot.name.." ("..thisSlot.id..":"..thisSlot.dmg..")\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  70.     else
  71.         stringThing[count] = "[\"Unused\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  72.     end
  73.    
  74.     if i<32 then
  75.         while not turtle.turnLeft() do end
  76.         while not turtle.forward() do end
  77.         while not turtle.turnRight() do end
  78.         x=x-1
  79.     end
  80.    
  81.     count = count+1
  82. end
  83.  
  84. while not turtle.back() do end
  85. turtle.down()
  86. turtle.down()
  87. while not turtle.forward() do end
  88.  
  89. z=58
  90. sleep(1)
  91. for i=1,32 do
  92.     local thisBarrel = peripheral.wrap("front")
  93.    
  94.     local thisSlot = thisBarrel.getStackInSlot(1)
  95.    
  96.     if thisSlot then
  97.         stringThing[count] = "[\""..thisSlot.name.." ("..thisSlot.id..":"..thisSlot.dmg..")\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  98.     else
  99.         stringThing[count] = "[\"Unused\"] = {[\"x\"] = "..x..", [\"y\"] = "..y..", [\"z\"] = "..z.."},"
  100.     end
  101.    
  102.     if i<32 then
  103.         while not turtle.turnRight() do end
  104.         while not turtle.forward() do end
  105.         while not turtle.turnLeft() do end
  106.         x=x+1
  107.     end
  108.    
  109.     count = count+1
  110. end
  111.  
  112. local myFile = fs.open("barrels","w")
  113.  
  114. for i=1,count-1 do myFile.writeLine(stringThing[i]) end
  115.  
  116. myFile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement