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

Automatic Diamond crafting with turtles

Started by ale624, 24 September 2013 - 05:33 PM
ale624 #1
Posted 24 September 2013 - 07:33 PM
Hey guys, i am attempting ot make a program that uses EE3's mimium stone to craft dimonds from cobblestone.

however i am having trouble with the first step XD

i need to put cobble from a chest behind it into slots 2 and 5 and then craft it and dump the flint into the chest infront of it. heres what i have so far:

-- Creates Flint from cobblestone


print("flint will be deposited into the chest infront")
print(" ")
print("working...")

turtle.turnRight()
turtle.turnRight()

l = 1


while l <= 1 do

  turtle.select(1)
  turtle.suck()
  turtle.select(2)
  turtle.suck()
  turtle.craft()
end

print("one")

elseif while l = >=1 do
  print("boobs")
  end

end

this should just make flint and then loop, however it said eof error when i try to run it :(/>

can you guys help me out?? Thanks!

(pastebin is: http://pastebin.com/NBjQq7VB )
Lyqyd #2
Posted 25 September 2013 - 01:00 AM
Split into new topic.
Luanub #3
Posted 25 September 2013 - 02:50 AM
You do not have an if to start the if statement for the elseif you have near the end of the code.

Proper if statement:

if something then --must have 1 if at the start
  do something
elseif something then -- can have as many as you need
  do something else
else -- can only have 1 and must be at the end of the block
  nothing worked so do this.
end -- need 1 end at the end of the block

You will also need to move the while loop, you can not combine it with an if statement to me knowledge. So…

if l > 1 then
  while l >= 1 do
	 print ("boobs") -- will infinitely print boobs since u never change l
  end
end

You also do not need the last end in the end. there is nothing for it to end.
Edited on 25 September 2013 - 12:55 AM
ale624 #4
Posted 26 September 2013 - 07:53 PM
You do not have an if to start the if statement for the elseif you have near the end of the code.

Proper if statement:

if something then --must have 1 if at the start
  do something
elseif something then -- can have as many as you need
  do something else
else -- can only have 1 and must be at the end of the block
  nothing worked so do this.
end -- need 1 end at the end of the block

You will also need to move the while loop, you can not combine it with an if statement to me knowledge. So…

if l > 1 then
  while l >= 1 do
	 print ("boobs") -- will infinitely print boobs since u never change l
  end
end

You also do not need the last end in the end. there is nothing for it to end.
cheers for that. helped me alot. i am now stuck on another issue. it will not do anything but grab(2) in the while loop.

heres my new code:

-- Creates Flint from cobblestone


print("flint will be deposited into the chest infront")
print(" ")
print("working...")

s=0

function grab(i)
  while s <= 63 do
  turtle.select(12)
  turtle.suck()
  t=turtle.getItemCount(12)
  turtle.drop(t-1)
  turtle.transferTo(i)
  s=s+1 
  end
end

function turn()
  turtle.turnRight()
  turtle.turnRight()
end

print("alive1")

function craft()
  while s >= 1 do
  turtle.select(4)
  turtle.craft()
  s=s-1
  end
end

print("alive2")

l=10

print("alive3")
while l <= 10 do
  turtle.select(10)
  turn()
  grab(2)
  print("alivein1")
  grab(10)
  print("alivein2")
  grab(6)
  print("alivein3")
  grab(9)
  print("alivein4")
  turtle.select(12)
  turtle.drop()
  print("alivein5")
  craft()
  turn()
  turtle.drop()
  turtle.select(12)
  print("alive4")

end
it prints all the alives however.
MudkipTheEpic #5
Posted 26 September 2013 - 08:18 PM
At the end of grab, put s=0

s is never being reset. Once it's 64, it stays 64.
ale624 #6
Posted 27 September 2013 - 05:41 AM
At the end of grab, put s=0

s is never being reset. Once it's 64, it stays 64.
XD i totally forgot about that! Thanks!