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

enchantment turtles?

Started by jakemg, 12 May 2013 - 06:34 PM
jakemg #1
Posted 12 May 2013 - 08:34 PM
Hi i am making my xp turtle with my tier 5 spawners and i have had him collecting xp and printing his level (he is level 162 =D) so i was wondering how to i get him to check his level then if his level his >==30 then he will enchant a level 30 enchant. (i know if then statements so that parts easy so i just don tknow the commands) oh and if my turtle has 64 book in his slot 16 then how do i have him only enchant one book then only place that one enchanted book to a chest below him (i know the turtle.drop() command so no need to go in to detail about that =D just truing to save some of your time)

Thanks =D
KaoS #2
Posted 12 May 2013 - 08:42 PM
I would recommend asking on the miscPeripherals thread, this subforum is generally for vanilla CC. Failing that try asking on IRC. I'm not saying what you did here is wrong, you just have a better chance of answers with the above methods in my opinion
jakemg #3
Posted 12 May 2013 - 08:51 PM
okay thank you
jeroentjuh99 #4
Posted 13 May 2013 - 03:36 AM
Direwolf20 made one of such machines. maybe if you search for the video on youtube it becomes clearer
LordIkol #5
Posted 14 May 2013 - 02:21 AM
hi Jake,

Here is a code that should do what you want.
Just add the code somewhere in the top of your actual code and then call the function enchanting in your main loop.
Did this on the way to work so


local function enchanting() 
local levels = p.getLevels()  -- Get the actual level // replace P with your peripheral variable.
  if levels >= 30 then  -- Check if its bigger then 30
   turtle.select(16)  -- Select the slot with the books
   turtle.transferTo(2,1) -- Transfer 1 Book to slot 2 (took to for better understanding of syntax)
   turtle.select(2)  -- select the slot that now contains 1 Book
   p.enchant(30)  -- Enchant the selected slot with // Replace p with your variable vor the peripheral 
   turtle.dropDown() --drop Down the book
  end
end