July 8, 201510 yr I was converting some old scripts to use Events oppose to states as it appears to me to be a lot cleaner and easier to apply maintenance. Currently they will run but don not loop? If Events arn't the best way of going about changing my scripting I would appreciate any direction or help! public int onLoop() throws InterruptedException { for ( Event e : allEvents){ execute(e); } return 1000; } When they complete i set them as finished. Any help appreciated! Btw i have one aSync event
July 8, 201510 yr If you set them to finished at the end of the first loop, will they still run in the second loop despite being "finished"? EDIT: Code is ran more or less line by line, so your onLoop would look like this: execute(allEvents.get(0)); execute(allEvents.get(1)); ..etc This means that there is no need to check them as finished, as when one of the executes is done the next will run. The only problem I see is the asynchronous event, which may not finish by its next loop. Maybe if you have the "finished" check within the Event itself, and then in your execute method: void execute(Event ev) { if (ev.finished) { //Last loop was complete, so we can continue ev.loop(); } } And in your Event class: void loop() { finished = false; //Reset the loop //logic here finished = true; } Edited July 8, 201510 yr by Bobrocket