This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
aiben16's profile picture

Combine two damaged gold swords with a Crafty Turtle!?

Started by aiben16, 18 June 2013 - 03:45 AM
aiben16 #1
Posted 18 June 2013 - 05:45 AM
Title: Combine two damaged gold swords with a Crafty Turtle!?

Hey guys

I have a Pigmen Farm and as they drop damaged gold swords, I want to combine these to a non-damaged sword, because I can then put it in a macerator to get the gold ingots out of it. After googling I found a topic in another forum, but the script in there does not work for me. I hope someone can help me out with this :)/>

Thanks in advance

Here is the code:


while true do
if turtle.getItemCount(1) == 1 and turtle.getItemCount(2) == 1 then-- if the turtle has an item in slot 1 and 2
turtle.select(1)-- select first slot
if not turtle.craft() then-- try to craft the two swords together, if it doesn't work, one was already fully repaired
for i = 1,2 do-- try to put both swords down into the barrel (only the fully repaired will go in)
turtle.select(i)
turtle.dropDown()
end
end
else-- if the turtle does not have an item in slot 1 and 2
turtle.suck()-- get another item from the input chest
end
end
Lyqyd #2
Posted 18 June 2013 - 01:42 PM
Split into new topic.

Which version are you on? It may be valuable to post a link to this topic in this bug report.
aiben16 #3
Posted 18 June 2013 - 03:52 PM
Well i got it up to the point where the turtle has to give the crafted item in the barrel. It just stays in the inventory :(/> What is wrong with the code?
Bomb Bloke #4
Posted 18 June 2013 - 06:37 PM
Is the turtle sitting directly on top of the barrel, or is there a pipe or some such in between them?

Is there anything already in the barrel? If that "anything" is a golden sword, is that sword damaged?
aiben16 #5
Posted 19 June 2013 - 03:30 AM
Yeah the turtle is directly on top of the barrel and the thing inside the barrel is a repaired gold sword as barrel do not support unrepaired swords
Bomb Bloke #6
Posted 19 June 2013 - 08:01 AM
How did that sword get in the barrel? If you remove it, can the turtle put one back in?
aiben16 #7
Posted 19 June 2013 - 08:28 AM
i put it there

no doesnt work with the sword removed :(/>
Bomb Bloke #8
Posted 19 June 2013 - 08:35 AM
What sort of barrel is it? One of these?

Does it work with non-barrels? What if you put a regular chest under the turtle instead?
aiben16 #9
Posted 19 June 2013 - 09:35 AM
Yeah this kind of barrel.

If i put a chest underneath it extracts the damaged swords directly in there without repairing them :(/>
Bomb Bloke #10
Posted 19 June 2013 - 09:45 AM
That's odd, it should repair them a bit then dump them in. Not necessarily fully, but at least somewhat. But whether it can at least place something in the chest below was all I wanted to know.

Working off the top of my head, there's two sorts of damagable items: ones with durability bars (eg used tools), and ones without (eg freshly crafted tools). What I'm guessing is that the turtle never repairs the sword such that the bar disappears, so even if it's at max durability, the barrel won't accept it.

If this is the case (check and see - does the durability bar go away once the turtle's "fully" repaired the sword? Can you put the turtle-repaired swords into the barrel yourself?), then you should indeed add your report to the thread Lyqyd linked. Be sure to include your MineCraft + ComputerCraft version numbers.
aiben16 #11
Posted 19 June 2013 - 12:38 PM
The swords coming out of the turtle are fully repaired, no durability bar.

So i will add this to the thread later :)/>