Computer Craft: XP Turtle.

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Wilda666

New Member
Jul 29, 2019
4
0
0
Hello all,

I have been attempting to code an XP Turtle (added by Misc Peripherals) with 2 programs. And I've given up.
The first program is one that will, on startup automatically collect all XP from my blaze farm.
The second program is one that when i type in the name of the program (eg. enchant), it will automatically enchant the item in the first slot.
Thanks for your help :)

From Wilda
 
Someone else can answer that. I don't know whether to be offended or disappointed. We're talking about scripts that are under 5 lines of code each. You can earn it.
 
DW's Xp turtle remember is has to face away from grinder witha chest in front or edit code to suit pastebin get R1jes23i NameHere
 
Apologies for before, i was really selfish.
Ok i've got the code for the enchanting and the collecting.
I just need a hand making a program for checking the XP level in the Turtle, i thought this should work:
m=peripheral.wrap("right")

m.getLevels()

It doesn't have an error message, but it doesn't say the level.

Wilda.
 
This is a basic program i did for my turtles (i set that as startup):
  • Slot 16 has a pile of books.
  • Turtle must be facing a chest or container where it places enchanted books.
  • Turtle prints the levels to screen and attempts to enchant every 1 seconds.
Hope it helps!

Code:
m = peripheral.wrap("right")
 
m.setAutoCollect(true)
 
function enchantBook()
if ( turtle.getItemCount(16) < 1) then
  return
  end
turtle.select(16)
turtle.transferTo(1,1)
turtle.select(1)
m.enchant(30)
turtle.drop()
end
 
 
while (true) do
print(m.getLevels())
  if m.getLevels() > 29 then
enchantBook()
end
sleep(1)
end