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

Worked Before

Started by Archimedes, 25 July 2013 - 02:16 AM
Archimedes #1
Posted 25 July 2013 - 04:16 AM
When I run "wood" program, It cycles through one tree then stops and bugs out. I have spent the last few hours attempting to debug it, but my yielded attempts have been unsuccessful. After running it through one cycle, it continuously switches from SLOT = 2 and SLOT = 16.

Coal in 1st slot,
Wood in 2nd slot,
Saplings in 15th slot,
Bone meal in 16th slot.

"Wood":

local function checkFuel()
  if turtle.getFuelLevel() < 20 then
	turtle.select(1)
	turtle.refuel(1)
  end
end

local function column()
local height = 0
while turtle.digUp() do
turtle.dig()
checkFuel()
turtle.up()
height = height + 1
end
turtle.dig()

checkFuel()

return height
end

local function columnDown(height)
for i=1,height do
checkFuel()
turtle.dig()
turtle.digDown()
turtle.down()
end
turtle.dig()
end

local function digmove()
checkFuel()
turtle.dig()
turtle.forward()
end

local function fell()
digmove()
local height = column()
turtle.turnRight()
digmove()
turtle.turnLeft()
columnDown(height)
end

local function replant()
turtle.select(15)
turtle.suck()
turtle.place()
turtle.turnLeft()
turtle.suck()
turtle.forward()
turtle.suck()
turtle.turnRight()
turtle.suck()
turtle.place()
turtle.turnRight()
turtle.suck()
turtle.place()
turtle.turnRight()
turtle.suck()
turtle.forward()
turtle.suck()
for slot=3,7 do
turtle.select(slot)
turtle.drop()
end
turtle.turnLeft()
turtle.turnLeft()
turtle.select(15)
turtle.place()
turtle.select(2)
while not turtle.compare() do
turtle.select(16)
turtle.place()
turtle.select(2)
end
end

function needCoal()
return turtle.getItemCount(1) < 10
end

function needBonemeal()
return turtle.getItemCount(16) < 10
end

function getCoal()
turtle.turnRight()
turtle.forward()
turtle.forward()
while turtle.getItemCount(1) < 60 do
sleep(0.5)
end
turtle.turnRight()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
end

function getBonemeal()
turtle.turnLeft()
turtle.forward()
while turtle.getItemCount(16) < 60 do
sleep(0.5)
end
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end

while true do
fell()
replant()
if needCoal() then
getCoal()
end
if needBonemeal() then
getBonemeal()
end
end
Lyqyd #2
Posted 25 July 2013 - 12:41 PM
Split into new topic.
MR_nesquick #3
Posted 25 July 2013 - 02:01 PM
did you update minecraft? after 1.4.7 you need more then 1 bone meal to grow a tree.


this is why it's changing between slot 2 and 16

while not turtle.compare() do
		turtle.select(16)
		turtle.place()
		turtle.select(2)
  end


edit: something tells me that the last tree is growing but the turtle is just sitting there and wasting bone meal until it's stops.
Archimedes #4
Posted 25 July 2013 - 06:54 PM
did you update minecraft? after 1.4.7 you need more then 1 bone meal to grow a tree.


this is why it's changing between slot 2 and 16

while not turtle.compare() do
		turtle.select(16)
		turtle.place()
		turtle.select(2)
  end

I am currently using "FTB Ultimate (v1.1.2) Minecraft Version 1.4.7" by the FTB Team.

EDIT: The turtle cycles through the tree, rebuilds it, bonemeals it, then when its going to take the tree again, It presents the error as listed before.
Lord_Spelunky #5
Posted 25 July 2013 - 06:58 PM
Maybe the tree doesn't have enough space to grow? Try to grow the trees yourself with bonemeal first. Sorry if i am wrong
MR_nesquick #6
Posted 25 July 2013 - 07:24 PM
the redwood have 4 difference item value's, try to swap out the one in slot 2

i get the same error when i use the wrong one
Archimedes #7
Posted 25 July 2013 - 07:58 PM
Maybe the tree doesn't have enough space to grow? Try to grow the trees yourself with bonemeal first. Sorry if i am wrong

The tree is growing fine, Its just after that. Here is a video that might be able to give you guys a clue on what the issue is.

http://youtu.be/pXQ4DH5seaA
Archimedes #8
Posted 25 July 2013 - 08:40 PM
So, It appears it has worked. I have Fir Log 1314:1 in Slot 1, and It compares that Log to the Log in front of it, counting it as that wood, although; When mined the block given by the tree is Fir Log 1315:1.

Thank you MR_nesquick for figuring that out. Although, It is strange. Thanks again.

Edit: New error, if anyone can help. Thanks.
MR_nesquick #9
Posted 25 July 2013 - 08:43 PM
no problem sir :)/>
Archimedes #10
Posted 26 July 2013 - 03:28 AM
I just ran into another error, if anyone is willing to help me out with such issue.
When I found such issue, and corrected it; as listed above, It ran perfectly collecting about 2000+ Fir Logs, placing them into a chest, and continuing such cycle. Although, I just came out to check my Turtle and the "Woody" Program, and it runs through a cycle, then stops once more, It plants the three saplings, goes to the chest, places Fir Logs into the chest, turns around, plants the forth sapling, then bonemeals it, and as it SHOULD start destroying the tree, It does not. Although, It turns to the right, and goes forward two spaces.

Video:(Will be added when fully uploaded)
Archimedes #11
Posted 26 July 2013 - 03:55 AM
Video:
http://youtu.be/X9_v6zyRIrk
MR_nesquick #12
Posted 26 July 2013 - 04:24 AM
that may be your 'getcaol' function. if it got less then 10 fuel in slot 1, then its just going to sit there until you fill it up


Spoiler

  if needCoal() then
		getCoal()
  end


function needCoal()
  return turtle.getItemCount(1) < 10
end


function getCoal()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  while turtle.getItemCount(1) < 60 do
		sleep(0.5)
  end
  turtle.turnRight()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
end

you got the same thing with bone meal.


edit: No. You are compraing needCoal() in your while true loop

needCoal is checking item amount in slot 1 and checkFuel is controlling how much fuel the turtle have.
Archimedes #13
Posted 26 July 2013 - 05:05 AM
that may be your 'getcaol' function. if it got less then 10 fuel in slot 1, then its just going to sit there until you fill it up


Spoiler

  if needCoal() then
		getCoal()
  end


function needCoal()
  return turtle.getItemCount(1) < 10
end


function getCoal()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  while turtle.getItemCount(1) < 60 do
		sleep(0.5)
  end
  turtle.turnRight()
  turtle.turnRight()
  turtle.forward()
  turtle.forward()
  turtle.turnRight()
end

you got the same thing with bone meal.
'

Wouldn't that already be covered by this local function;

local function checkFuel()
  if turtle.getFuelLevel() < 20 then
	    turtle.select(1)
	    turtle.refuel(1)
  end
end