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

Enchanting Program Help?

Started by popdog15, 25 July 2013 - 04:44 PM
popdog15 #1
Posted 25 July 2013 - 06:44 PM
I have a zombie pigman mob farm, and I have an enchanting turtle to pick up all the xp, and to use as an enchanting table. I'm trying to make it where if I put an item in the 16'th slot, that it'll be enchanted. Help?

x = true
xp = peripheral.wrap("right")
  lvl = xp.getLevels()
  xp.setAutoCollect(true)
while true do
if turtle.getItemCount(16) ==< 0 then
   turtle.select(16)
   xp.enchant(30)
   end   


turtle.attack()
for i = 1, 14 do
  turtle.select(i)
  os.sleep(.1)
   turtle.dropDown()
end
  print("I have "..lvl.." levels.")
  turtle.select(16)
  if turtle.getItemCount(16) > 0 then
   xp.enchant(30)
   turtle.select(16)
   turtle.dropDown()
  end
end
Engineer #2
Posted 25 July 2013 - 06:48 PM
check line 6. We only have those compare methods:

== -- Equals
~= -- is not equal to
<= -- Less then or equals to
>= -- Greater then or equals to
>   -- Greater then
<   -- Less then
Also use sleep, rather than os.sleep.


Also for future reference, please put in the error that the program gave you. Also some background information on your program is appreciated.
Lord_Spelunky #3
Posted 25 July 2013 - 06:49 PM
Well with the new update, you might not have it on modpacks, if you use os.pullEvent() there is a turtle inventory event. So you could make it pull event and do that? Have I got what you want right?
popdog15 #4
Posted 25 July 2013 - 06:55 PM
Thanks for that information, I fixed the code.