Posted 23 January 2016 - 04:23 AM
Context: I've been writing up a program for a turtle to convert stone into cobblestone, in order to save myself the trouble of course. The problem is, when I use "turtle.dropDown(63)" in my code, it drops the entire stack of cobblestone, every single time.
I know I can alter the code in this program so it can get away with dropping entire stacks, but if possible please could someone tell me a quick way to program my turtle to only drop the amount of items that I tell it to, or if someone could please direct me to a place which addresses and has an solution to this issue (because so far I haven't been able to find such a place).
That being said, here is the code:
I know I can alter the code in this program so it can get away with dropping entire stacks, but if possible please could someone tell me a quick way to program my turtle to only drop the amount of items that I tell it to, or if someone could please direct me to a place which addresses and has an solution to this issue (because so far I haven't been able to find such a place).
That being said, here is the code:
local err = 0 -- err is short for "error count"
---------
function errd()
err = err + 1
end -- errd is short for "error detected", I put if statements in the code involving this so it will add to the error count if the program detects anything unusual.
---------
function doIstop()
if err > 0 then
print("Error detected, stopping...")
return
end
end -- this program is to stop functions from running if there is an error/s detected.
--------------------------------------
function giveNtake()
print("Dropping Cobblestone...")
turtle.select(2)
turtle.dropDown(63) -- drops 63 C.Stone
-- the turtle seems to drop the
-- entire thing instead of the 63 I set it at! why!?!
if turtle.dropDown() == false then
errd()
end
print("Aquiring more Stone...")
turtle.select(1)
turtle.suckUp(63) -- gets 63 Stone
turtle.getItemCount(1)
if turtle.getItemCount() ~= 64 then
errd()
end
print("Back to work.")
end
--------------------------------------
function digNplace()
print("Commencing 'Digging and Placing'")
turtle.select(1) -- location of stone
turtle.detect()
if turtle.detect() == false then
for dig = 0, 62 do
turtle.place()
turtle.dig()
end
else
errd()
end
end
--------------------------------------
-- This is just where I test each function
giveNtake()
doIstop()
--digNplace()
--doIstop()
--giveNtake()
--doIstop()
While I'm complaining about this issue, I might just put something about it in the suggestions area.