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

Yielding Problem

Started by zanenewberry, 27 September 2012 - 12:08 AM
zanenewberry #1
Posted 27 September 2012 - 02:08 AM
Hello, I need help I need this program to stop yielding, I need this to run On and On and On


term.clear()

term.setCursorPos(1,1)

function main()


while true do

if rs.testBundledInput("left", colors.black) == false then

shell.run("monitor", "back", "offline")

if rs.testBundledInput("left", colors.black) == true then

if rs.testBundledInput("left", colors.lime) == false then

shell.run("monitor", "back", "statusb")

end

end

if rs.testBundledInput("left", colors.lime) == true then

if rs.testBundledInput("left", colors.yellow) == false then

shell.run("monitor", "back", "statusg")

end

end

if rs.testBundledInput("left", colors.yellow) == true then

if rs.testBundledInput("left", colors.white) == false then

shell.run("monitor", "back", "statusy")

end

end

if rs.testBundledInput("left", colors.white) == true then

shell.run("monitor", "back", "statusw")

end

end

end

end

main()

Can I get some help please? I need to know how to stop it from yielding.
RemoteMine #2
Posted 27 September 2012 - 02:57 AM
Put sleep([amount])

Look up sleep() on the wiki, I don't know that much about it. If you look it up I bet you could solve this yourself.
chiloxsan #3
Posted 27 September 2012 - 02:59 AM
Try to add a sleep(0.1) before you close your while loop.

Also, please use code tags (button next to the picture on the toolbar) when posting code. It makes it a lot easier to understand.
dimitriye98 #4
Posted 28 September 2012 - 11:51 PM
You could use events to wait for a signal change before looping… Meh, I can't be bothered to look up the right event right now, but you can use the wiki.