Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- warning: can only run on a crafty turtle
- -- TODO: add turtle detection
- -- Stack Keys
- -- |- name (Sign)
- -- |- rawName (item.sign)
- -- |- id
- -- |- dmg (0)
- -- |- maxSize (16 - max size of stack)
- -- |- ench(table)
- -- Empty for sign
- -- "Efficiency V"
- -- |- qty
- local chest = peripheral.wrap('front')
- local function checkChest()
- local chestStacks = chest.getAllStacks()
- local weakestBow = 1
- local strongestBow = 1
- for k,v in pairs(chestStacks) do
- if table.getn(v.ench) > 0 then
- print("Enchant found - skipp")
- else
- if v.dmg > chestStacks[strongestBow].dmg then strongestBow = k end
- if v.dmg < chestStacks[weakestBow].dmg then weakestBow = k end
- end
- end
- return {weakestIndex=weakestBow, weakestStack=chestStacks[weakestBow], strongestIndex=strongestBow, strongestStack=chestStacks[strongestBow]}
- end
- ccResults = checkChest()
- print("Strongestbow is #"..ccResults.strongestIndex.." at dmg "..ccResults.strongestStack.dmg)
- print("Weakestbow is #"..ccResults.weakestIndex.." at dmg "..ccResults.weakestStack.dmg)
- print("Beginning chest withdraw transaction...")
- success = chest.pullItemIntoSlot('east',ccResults.weakestIndex,1,1)
- print(success)
Advertisement
Add Comment
Please, Sign In to add comment