// Sets up the jobs public void onStart() { System.out.println("Agility Arena has been started"); System.out.println("Version: 2.1, released on 16 March 2013"); // Setting up jobs Node[] jobs = { new Restore(), new Heal(), new TagDispenser(), new ClimbUp(), new Bank(), new Wander(), new Path() }; container = new Tree(jobs); // Setting up GUI EventQueue.invokeLater( new Runnable() { @Override public void run() { gui.setVisible(true); } }); while (gui.isShowing()) { sleep(100, 200); } }
@Override public int loop() { System.out.println("Mainloop called."); while (gui.isShowing()) { System.out.println("Waiting for the GUI!"); return Random.nextInt(100, 200); } if (stopScript) { System.out.println("Terminating script!"); return -1; } if (container != null) { Node job = container.state(); if (job != null) { container.set(job); getContainer().submit(job); job.join(); } } return Random.nextInt(50, 100); }