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

[Request][Lua noob] Need help with auto enchanting

Started by WhiteWolf1423, 22 March 2013 - 11:34 AM
WhiteWolf1423 #1
Posted 22 March 2013 - 12:34 PM
So basically I'm playing FTB mindcrack and I really wanna setup a automatic enchanting turtle!
I assume this wouldn't be the hardest thing to do because all I want it to do is basically pick a book up from a chest underneith it.
enchant it if it's level 30 or higher and drop the book down in the chest underneith it again (Of course I'll have filters to pull out the enchanted books)
If anyone could help me with this (A complete code would be lovely!) That'd be freaking awesome!

- Lucas
unobtanium #2
Posted 24 March 2013 - 02:35 AM
First, hello!
Second: You posted in the wrong section -.-
Third: In this section, where the FINISHED turtle programs are, are some enchanting turtles. They are doing what you need. Search first please :D/>
Engineer #3
Posted 25 March 2013 - 04:23 AM
Hmm.. Something like this?

local timeout = 30
local xp = peripheral.wrap( "right" )
turtle.select( 1 )
while true do
	if xp.getLevels() >= 30 then
		turtle.suckDown()
		local amount = turtle.getItemCount( 1 )
		if amount > 1 then
			amount = amount - 1
			turtle.dropDown(amount)
		end 
                xp.enchant( 30 )
		turtle.dropDown()
	end 
	sleep( timeout )
end
Lyqyd #4
Posted 25 March 2013 - 06:19 AM
Moved to Ask a Pro.