Posted 20 August 2013 - 06:06 PM
Hey guys,
Thanks for the help in advance.
So, I've had a program that just places and then breaks a stack of gravel at a time… but now my dreams of world domination have circled back and now I'd like it to be able to process 15 stacks! Shockingly daring I know.
Here's my code as it stands.
The problem is, that when the first stack finishes, it places the 64th flint in inv slot #1, this is fine, but then of course it craps out like it is supposed to. So what I'd like it to do… (and this is also because I'd like to understand how to compare items in an inventory in this specific way for another program I'd like to work on)… is have the turtle have a function that compares it's current slot (sCount) to slot 16 (hardcoded is fine, I can make it a variable afterwards once I'm sure I understand)
I know my programming is bad and I should feel bad, but thanks for reading!
Thanks for the help in advance.
So, I've had a program that just places and then breaks a stack of gravel at a time… but now my dreams of world domination have circled back and now I'd like it to be able to process 15 stacks! Shockingly daring I know.
Here's my code as it stands.
--Gravel to Flint
--slotCount() Counter
sCount = 1
turtle.select(sCount)
--Changes Inventory slot when slot is empty
function slotCount()
while turtle.getItemCount(sCount) < 1 do
sCount = (sCount%15)+1
end
end
print("Making Gravel into Flint. Uses inventory slot 1-15.")
print("Press Control + T to stop.")
sleep(.5)
print("3")
sleep(.5)
print("2")
sleep(.5)
print("1")
sleep(.5)
print("Starting...")
while true do
turtle.place()
if turtle.detect() then
turtle.dig()
else
print("Gravel Supply Expended")
break
end
end
The problem is, that when the first stack finishes, it places the 64th flint in inv slot #1, this is fine, but then of course it craps out like it is supposed to. So what I'd like it to do… (and this is also because I'd like to understand how to compare items in an inventory in this specific way for another program I'd like to work on)… is have the turtle have a function that compares it's current slot (sCount) to slot 16 (hardcoded is fine, I can make it a variable afterwards once I'm sure I understand)
I know my programming is bad and I should feel bad, but thanks for reading!