- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
denecity
-
Content Count
2 -
Joined
-
Last visited
Posts posted by denecity
-
-
Today i was writing a program for my Mystical Agriculture Farm.
The program is supposed to steer the Robot in random directions and check the Robot's energy after each cycle.
After a certain threshold (now 10%) is reached, it sends the robot to a charger.
The energy check and recharging works like a charm, but as soon as i add the while-loop and the random movements, i get a "too long without yielding" error (the full error is pasted at the end of the github file).
github: The Code
"too long without yielding" in robot farming loop
in Programming
Posted
Thanks for the quick response.
I went ahead and added the line right before the last "end".
Sadly it doesn't seem to fix the issue (or if it does it opens another), as the robot now just freezes without making a move.
After i cancelled the program after approximately 1 minute (Ctrl+Alt+C) this error appeared:
EDIT: it seems the error was caused by the server.
After i added os.sleep(0) to the end of my main-loop the program worked.
Thanks for your answer and also thanks payonel for your solution for loops with long event intervals.