Posted 11 May 2013 - 07:57 PM
whats the code to get my turtle to print its level?
and how do i get it to coolect xp
and how do i get it to coolect xp
RichardG867 said: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:
Returns the amount of XP obtained.
- 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
local m = peripheral.wrap("right")
Ok, now we can interact with the XP upgrade on the turtle. Let's print out it's current XP level, which should be zero.print(m.getLevels())
Now, let's just print out the amount of XP orbs the turtle is currently storingprint(m.get())
m.collect()
m.setAutoCollect(true)
The argument for setAutoCollect() must be a boolean (true or false). If you wish to stop auto-collecting, simply do this:m.setAutoCollect(false)
Or, you can simply restart the turtle