This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mphillips43's profile picture

Help with enchanting turtle

Started by mphillips43, 13 May 2013 - 07:36 PM
mphillips43 #1
Posted 13 May 2013 - 09:36 PM
I have a T5 skeleton spawner feeding an enchanting turtle with plenty of xp. I am wanting to make a system that works like a password program. I have it setup so that when I run the program it displays the current xp level and then asks how many levels you want it to use for an enchant. It looks like this:

My Current Level is: "m.getLevel() goes here"
Enchantment Level: requested level entered here

in my code I have it set so that m.enchant(read()), but when I enter a number i get this:

enchant:15: bad argument #1 (expected number)
Lyqyd #2
Posted 14 May 2013 - 02:43 PM
Split into new topic.

read() returns a string. Use tonumber(read()) instead.
PixelToast #3
Posted 14 May 2013 - 02:45 PM
you have to convert the string from read() to a number using:
m.enchant(tonumber(read()))