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/4mdrCL8C
What should I add for chosing in-screen the enchantment level?
A feature for an enchanting system w/ turtle
Started by KiraGio, May 01 2013 08:08 AM
2 replies to this topic
#1
Posted 01 May 2013 - 08:08 AM
#2
Posted 01 May 2013 - 11:14 AM
In the "enchantBook()" function, change it to this, and simply input the number of what level you would like to enchant at.
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!
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!
#3
Posted 01 May 2013 - 11:39 AM
QuantumGrav, on 01 May 2013 - 11:14 AM, said:
In the "enchantBook()" function, change it to this, and simply input the number of what level you would like to enchant at.
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!
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!
If I don't bother you, How could I connect it to a touch screen monitor? Would it be too long?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











