whats the code to get my turtle to print its level?
and how do i get it to coolect xp
how to get my turtle to print level
Started by jakemg, May 11 2013 06:57 PM
1 reply to this topic
#1
Posted 11 May 2013 - 06:57 PM
#2
Posted 11 May 2013 - 07:45 PM
Well, this is from the mod MiscPeripherals so you should probably state that in the main post. However, I have used this mod regularly and know how everything works to an extent.
So, now that we know the correct commands, let's get started:
First you must wrap the peripheral, which for all of his items are on the right of the turtle, so let's do that first:
Now that we have all your basic methods down, let's talk about collecting then send you on your merry way:
For collecting you can either repeatedly call the m.collect function or you can call m.setAutoCollect(true) at the top of your program to have the turtle repeatedly collect nearby XP orbs until he is restarted.
collect()
and lastly, setAutoCollect() (Remember, this is to go at the top of your program)
Quote
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:
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
- Other XP turtles
First you must wrap the peripheral, which for all of his items are on the right of the turtle, so let's do that first:
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 storing
print(m.get())
Now that we have all your basic methods down, let's talk about collecting then send you on your merry way:
For collecting you can either repeatedly call the m.collect function or you can call m.setAutoCollect(true) at the top of your program to have the turtle repeatedly collect nearby XP orbs until he is restarted.
collect()
m.collect()
and lastly, setAutoCollect() (Remember, this is to go at the top of your program)
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
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











