Jump to content




Automatic Diamond crafting with turtles


  • You cannot reply to this topic
5 replies to this topic

#1 ale624

  • Members
  • 3 posts

Posted 24 September 2013 - 06: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 )

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 25 September 2013 - 12:00 AM

Split into new topic.

#3 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 25 September 2013 - 01: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 by Luanub, 25 September 2013 - 01:55 AM.


#4 ale624

  • Members
  • 3 posts

Posted 26 September 2013 - 06:53 PM

View PostLuanub, on 25 September 2013 - 01:50 AM, said:

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.

#5 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 26 September 2013 - 07:18 PM

At the end of grab, put s=0

s is never being reset. Once it's 64, it stays 64.



#6 ale624

  • Members
  • 3 posts

Posted 27 September 2013 - 04:41 AM

View PostMudkipTheEpic, on 26 September 2013 - 07:18 PM, said:

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!





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users