Posted 20 August 2012 - 09:47 AM
Hi all, spanking new programmer here, lots of fun so far and have made lots of progress.
im having an issue with creating a repeat loop for my farming turtle though, ive spent about 5 or 6 hours trying to figure it out but it is burning a hole in my brain. here is the loop i have made
————————————————————————————————
print("Breadurtle sings: Breeaaaadfannn, dunnuh dunnuh duuuuu…")
print("Breadurtle says: Bread?")
input = read()
if input == "yes" then
print("Breadurtle shouts: Breaaaaddd!")
startroute()
fsection()
fsection()
fsection()
fsection()
elseif input == "no" then
print("Breadurtle sniffles: Aw ok")
else
repeat
print("Chicken?")
input = read()
until input == "yes" or "no" – this part is not working
end
sleep(2)
term.clear()
term.setCursorPos(1,1)
————————————————————————————
when i dont type yes or no, it prints out "chicken?" and lets me input something. The second time i try to input something, the pc sleeps for 2 seconds and then clears out. Basically what im trying to do is, if i dont input yes or no, i want it to repeat the "chicken?" text until i DO input yes or no.
I may not even be using the correct loop haha, what would you guys suggest?
thanks in advance
im having an issue with creating a repeat loop for my farming turtle though, ive spent about 5 or 6 hours trying to figure it out but it is burning a hole in my brain. here is the loop i have made
————————————————————————————————
print("Breadurtle sings: Breeaaaadfannn, dunnuh dunnuh duuuuu…")
print("Breadurtle says: Bread?")
input = read()
if input == "yes" then
print("Breadurtle shouts: Breaaaaddd!")
startroute()
fsection()
fsection()
fsection()
fsection()
elseif input == "no" then
print("Breadurtle sniffles: Aw ok")
else
repeat
print("Chicken?")
input = read()
until input == "yes" or "no" – this part is not working
end
sleep(2)
term.clear()
term.setCursorPos(1,1)
————————————————————————————
when i dont type yes or no, it prints out "chicken?" and lets me input something. The second time i try to input something, the pc sleeps for 2 seconds and then clears out. Basically what im trying to do is, if i dont input yes or no, i want it to repeat the "chicken?" text until i DO input yes or no.
I may not even be using the correct loop haha, what would you guys suggest?
thanks in advance