Posted 28 June 2017 - 02:37 AM
Hello,
Currently working with something that requires to ask the user to put "x" amount of "x" into a specific slot before the code continues. If that isn't the case it is supposed to wait for a keystroke for example before checking again.
I tried around for 2 hours now and finally gave up.
Here are examples of what I have tried:
repeat - until
In theory it should stop as soon as you put saplings in the selected slot, shouldnt it!?
while true loop if its unequal to
Same for this one. This one is the basic version of what I tried to use. Shouldnt it check the slot again and again?
Instead without the "term.clear()" it would just keep spamming the text even if saplings are in the selected slot!?
Does anybody know what I am doing wrong?
Currently working with something that requires to ask the user to put "x" amount of "x" into a specific slot before the code continues. If that isn't the case it is supposed to wait for a keystroke for example before checking again.
I tried around for 2 hours now and finally gave up.
Here are examples of what I have tried:
repeat - until
local data = turtle.getItemDetail()
turtle.select(1)
if data.name == "minecraft:sapling" then
print("Correct!")
else
repeat
print("Not a sapling.")
sleep(1)
until data.name == "minecraft:sapling"
end
In theory it should stop as soon as you put saplings in the selected slot, shouldnt it!?
while true loop if its unequal to
local data = turtle.getItemDetail()
if data.name == "minecraft:sapling" then
print("#currently there are: ", data.count, " saplings in slot .")
elseif data.name ~= "minecraft:sapling" then
while true do
term.clear()
term.setCursorPos(1,1)
print("---------------------------------------")
print("--pls put saplins in slot 1---")
print("---------------------------------------")
sleep(5)
if data.name == "minecraft:sapling" then
break
end
end
end
Same for this one. This one is the basic version of what I tried to use. Shouldnt it check the slot again and again?
Instead without the "term.clear()" it would just keep spamming the text even if saplings are in the selected slot!?
Does anybody know what I am doing wrong?
Edited on 28 June 2017 - 01:58 AM