XP Turtle, someone know how it works?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

CrazyButt

New Member
Jul 29, 2019
5
0
0
Hello everyone, i just find out about the xp turtle and was wondering if someone know any commands to collect the xp around it. I am already familiar with the basic coding for mining turtle and such, so if you have any information on how to collect the xp it would be a huge help ;)
 

plzent3r

New Member
Jul 29, 2019
190
0
0
try using this as the startup program

x = peripheral.wrap("whatever side the table is on")
x.setAutoCollect(true)

that will set it to automatically collect any xp around it whenever it turns on as well as after it turns on. if you want a program to find out how many levels you could try this

x = peripheral.wrap("side")
lvl = x.getLevels()
print("I have " .. lvl .. " levels."

if you need a enchanting program I can give you one for that as well. Just let me know if you need it.
 

slay_mithos

New Member
Jul 29, 2019
1,288
0
0
Just as a slight improvement, you should put "local" before the first time you write a variable and function name.

It doesn't do much, but it apparently makes it use slightly less memory.

The only cases where you should refrain from using local variables is when you need the variable/function to be accessible outside of the program, so when your program is in fact an API instead.
 

Abdiel

New Member
Jul 29, 2019
1,062
0
0
http://www.computercraft.info/forums2/index.php?/topic/4587-cc15mc147-miscperipherals-31/

XP Upgrade
Craft a Turtle alongside an Enchantment Table to get a XP Turtle. It is able to store XP and enchant items using the stored levels.
Exposes the following functions:
  • add(amount): Adds XP from XP bottles or monster eggs, using amount (optional, defaults to as much as possible) of the item in the current slot. Returns the amount of XP added.
  • get(): Returns the total amount of XP on the turtle.
  • getLevels(): Returns the amount of XP levels on the turtle.
  • collect(): Collects XP from XP orbs on the ground in a 2 block radius around the turtle. Returns the amount of XP collected.
  • setAutoCollect(autoCollect): If autoCollect is true, allow the turtle to automatically collect XP periodically.
  • enchant(levels): Enchants the item in the current slot using the specified levels. Returns true if successful, false if not.
  • get/getUp/getDown(): Gets XP from the following XP sources:
    • Other XP turtles
    • Furnaces, IC2 Iron Furnaces and Induction Furnaces, Thermal Expansion Powered Furnaces (sucking the item in the output slot(s))
    • Thaumcraft Brain in a Jar
    Returns the amount of XP obtained.
 

VictusBcb

New Member
Jul 29, 2019
23
0
0
I was wondering if anyone could help me out. My turtle looks like it's picking up xp (it's an attack turtle with an xp upgrade), but doesn't actually gain any experience whatsoever. Did I mess my code up at all (Haven't gotten any syntax errors, but there could always be a derp that I may have missed)? Or is there a config somewhere on my server that I have to enable this feature? I thank you for any help I can get.

http://pastebin.com/Yd2Bxd7g
 

plzent3r

New Member
Jul 29, 2019
190
0
0
Victus, in your code, where you have it printing the amount of levels, you need the function to be enchant.getLevels(), not just enchant.get()
That should display your levels correctly.
 

VictusBcb

New Member
Jul 29, 2019
23
0
0
Oh, I didn't even try getLevels(), since get() wasn't even returning experience at all (Which the site for miscp says that get() shows xp on the turtle). Thanks for the help :D
 

Harvest88

New Member
Jul 29, 2019
1,365
-1
0
Just a word of warning a player said they're capped at least to 500 levels so don't goes and make auto grinding and think you won't be breaking servers cause the turtles will collects the orbs. I like MFR grinders better even when filled they will just stop working so at least I won't get 37 levels worth of lag now.
 

Top_ARO

New Member
Jul 29, 2019
23
0
0
What about getting xp from other xp turtles? I've tried
xp=peripheral.wrap("right")
xp.get()
with no success. I had thought it would work since
get/getUp/getDown(): Gets XP from the following XP sources:
  • Other XP turtles
  • Furnaces, IC2 Iron Furnaces and Induction Furnaces, Thermal Expansion Powered Furnaces (sucking the item in the output slot(s))
  • Thaumcraft Brain in a Jar
Returns the amount of XP obtained.
It's the other xp turtles that I'm after. Can anyone help?
 

plzent3r

New Member
Jul 29, 2019
190
0
0
x = peripheral.wrap(side of enchantment table)
pretty sure the code for it is
x.get(direction)
so if the turtle was trying to get exp from another turtle in front of it the command would be x.get("front")
I think. Have not been working with turtles recently. Sorry if I'm wrong.
 

Top_ARO

New Member
Jul 29, 2019
23
0
0
x = peripheral.wrap(side of enchantment table)
pretty sure the code for it is
x.get(direction)
so if the turtle was trying to get exp from another turtle in front of it the command would be x.get("front")
I think. Have not been working with turtles recently. Sorry if I'm wrong.

I'll try that. Seems plausible. Thanks.
 

Top_ARO

New Member
Jul 29, 2019
23
0
0
I'll try that. Seems plausible. Thanks.
x = peripheral.wrap(side of enchantment table)
pretty sure the code for it is
x.get(direction)
so if the turtle was trying to get exp from another turtle in front of it the command would be x.get("front")
I think. Have not been working with turtles recently. Sorry if I'm wrong.

Just tested it, no success.
 

plzent3r

New Member
Jul 29, 2019
190
0
0
From the Misc Peripherals post...

  • add(amount): Adds XP from XP bottles or monster eggs, using amount (optional, defaults to as much as possible) of the item in the current slot. Returns the amount of XP added.
  • get(): Returns the total amount of XP on the turtle.
  • getLevels(): Returns the amount of XP levels on the turtle.
  • collect(): Collects XP from XP orbs on the ground in a 2 block radius around the turtle. Returns the amount of XP collected.
  • setAutoCollect(autoCollect): If autoCollect is true, allow the turtle to automatically collect XP periodically.
  • enchant(levels): Enchants the item in the current slot using the specified levels. Returns true if successful, false if not.
  • get/getUp/getDown(): Gets XP from the following XP sources:
    • Other XP turtles
    • Furnaces, IC2 Iron Furnaces and Induction Furnaces, Thermal Expansion Powered Furnaces (sucking the item in the output slot(s))
    • Thaumcraft Brain in a Jar