Jump to content




Elevator code; too long without yielding.


  • You cannot reply to this topic
2 replies to this topic

#1 GrayTheWolf

  • Members
  • 7 posts

Posted 06 June 2013 - 12:49 AM

I have been getting this error also.
I am making an elevator using bundled cables. You press a button and it sends the minecart up to that same color floor.

The code runs for a bit, and then crashes giving the "too long without yielding" error.

Here it is:
while true do
if redstone.testBundledInput("right", colors.orange) then
redstone.setBundledOutput("left", 0)
redstone.setBundledOutput("left", colors.orange)
end
if redstone.testBundledInput("right", colors.magenta) then
redstone.setBundledOutput("left", 0)
redstone.setBundledOutput("left", colors.magenta)
end
end
restart("")

Hoping someone can give some insight as to why I am getting this error. And hopefully it will help OP also.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 06 June 2013 - 12:52 AM

Split into new topic. It would have been best to post in the New Members topic.

Try adding the line `os.pullEvent("redstone")` just below the `while true do` and before your first if statement. That will cause it to pause and wait for changes in redstone state.

#3 GrayTheWolf

  • Members
  • 7 posts

Posted 06 June 2013 - 12:56 AM

View PostLyqyd, on 06 June 2013 - 12:52 AM, said:

Split into new topic. It would have been best to post in the New Members topic.

Try adding the line `os.pullEvent("redstone")` just below the `while true do` and before your first if statement. That will cause it to pause and wait for changes in redstone state.

Thanks. I will try that.


Edit:

Thanks so much! That fixed it!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users