Posted 01 January 2013 - 06:43 AM
Hello all,
I picked up Beginning Lua Programming this weekend and after getting through the first 2 chapters I decided to try my first program.
It's a fairly basic 3x3 tunnel mining program that:
My particular question is regarding my cobblestone check&discard step. It creates a short pause while it performs the check and drops cobblestone. Is there a better way to speed up this check? I could always make it check less frequently. I understand it's overkill early on, but as your inventory fills with gems and ores the check is nice.
Code segment in question:
Remainder of code for those curious.
I picked up Beginning Lua Programming this weekend and after getting through the first 2 chapters I decided to try my first program.
It's a fairly basic 3x3 tunnel mining program that:
- places a torch every 4 blocks
- handles gravel (except with torch placement, but I think I can fix that)
- discards all cobblestone gathered during its journey (it does this at each torch placement)
- refuels conservatively (automatically) - this assumes coal/charcoal as fuel, otherwise you'll overfuel. May add check in the future for fuel type, but I always use coal.
- returns to exactly where it began.
My particular question is regarding my cobblestone check&discard step. It creates a short pause while it performs the check and drops cobblestone. Is there a better way to speed up this check? I could always make it check less frequently. I understand it's overkill early on, but as your inventory fills with gems and ores the check is nice.
Code segment in question:
function dropcobble()
for i=4,16 do
turtle.select(i)
if turtle.compareTo(2) then
turtle.drop()
end
end
end
Remainder of code for those curious.