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

"Too long without Yielding"

Started by martin509, 23 March 2013 - 12:45 PM
martin509 #1
Posted 23 March 2013 - 01:45 PM
Hello, I am converting the old game "Hurdles" into an arcade cabinet. I have gotten down the following parts:
Button-press jumping
restart on monitor via separate one-line startup program that starts monitor with hurdles
"while true do" loop before game starts that waits for redstone input with a "Press Button" notification on screen in order to start game.
All this works well, except the loop. Instead of running indefinitely, the OS terminates it because it went too long without "yielding"
What?
Can I have some help here? How can I make an indefinite "wait for input" sort of loop?
By the way, here is the loop itself.

while true do
term.setCursorPos(x/2,y/2)
write("Press Button")
if redstone.getInput("left") == true then
break
end
end
The error is
"Pressbios:83: Too long without yielding"
So, yeah.
Engineer #2
Posted 23 March 2013 - 02:05 PM
What you are looking for is:

os.pullEvent('redstone')

this waits till a redstone wire updates (on -> off and off -> om)
martin509 #3
Posted 23 March 2013 - 02:11 PM
wait, where can I put that in?
I know about os.pullEvent, but where does that fit in my loop?
Edit: Oh, nevermind.