18 posts
Posted 01 May 2013 - 09:08 AM
Title: "A feature for an enchanting system w/ turtle"
Hello, I've got this code from Direwolf20, I've edited a bit of it.
http://pastebin.com/4mdrCL8CWhat should I add for chosing in-screen the enchantment level?
36 posts
Location
United States
Posted 01 May 2013 - 12:14 PM
In the "enchantBook()" function, change it to this, and simply input the number of what level you would like to enchant at.
function enchantBook()
turtle.select(1)
turtle.suckUp()
turtle.dropUp(turtle.getItemCount(1)-1)
while true do
term.write("How many levels should I enchant? : ")
nLevels = io.read() -- Main line for getting input. Look up a tutorial if you aren't familiar with io.read(), it's very useful!
if tonumber(nLevels) and tonumber(nLevels) > 0 and tonumber(nLevels) <= 30 then
nLevels = tonumber(nLevels)
break
end
end
m.enchant(nLevels)
turtle.dropUp()
end
If you want to not have to manually input a number every time, simply change the 30 in Direwolf's code to whatever level you would like. Hope that helps!
18 posts
Posted 01 May 2013 - 12:39 PM
In the "enchantBook()" function, change it to this, and simply input the number of what level you would like to enchant at.
function enchantBook()
turtle.select(1)
turtle.suckUp()
turtle.dropUp(turtle.getItemCount(1)-1)
while true do
term.write("How many levels should I enchant? : ")
nLevels = io.read() -- Main line for getting input. Look up a tutorial if you aren't familiar with io.read(), it's very useful!
if tonumber(nLevels) and tonumber(nLevels) > 0 and tonumber(nLevels) <= 30 then
nLevels = tonumber(nLevels)
break
end
end
m.enchant(nLevels)
turtle.dropUp()
end
If you want to not have to manually input a number every time, simply change the 30 in Direwolf's code to whatever level you would like. Hope that helps!
Wow! That helped a lot, thanks!
If I don't bother you, How could I connect it to a touch screen monitor? Would it be too long?