Posted 13 July 2013 - 09:39 PM
I currently have an XP turtle set up to collect experience, then enchant the books. I'm attempting to make him display a line, similar to the following:
Here is my full code:
When the script runs, even without the additional level displaying (just print("Enchanted" ..num)), it returns an error saying the following:
In the lua prompt, I can run
Enchanted # books so far, and currently level #.
Here is my full code:
level = 0
local num = 0
num = 0
xp = peripheral.wrap("right")
xp.setAutoCollect(true)
while true do
-- Detect if it's level 30 and enchant
if xp.getLevels() > 30 then
turtle.select(1)
turtle.suckUp()
drop = turtle.getItemCount(1) - 1
turtle.dropUp( drop )
xp.enchant(30)
num = num + 1
-- Store the enchanted book
turtle.drop()
sleep(5)
end
-- Display
level = xp.getLevels()
term.setCursorPos(1, 1)
term.clear()
print("Enchanted " ..num "books so far, and currently level " ..level)
end
When the script runs, even without the additional level displaying (just print("Enchanted" ..num)), it returns an error saying the following:
27: attempt to call a number
In the lua prompt, I can run
print ( num )
and it will return the correct number. But I can't seem to use it with any sort of text. Any assistance would be apprecieated.