From 201af45caf8ef9f0830512c8799b56032d12bad4 Mon Sep 17 00:00:00 2001 From: gered Date: Wed, 12 Apr 2017 21:51:38 -0400 Subject: [PATCH] update example code in README.md --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 40c3f0a..4da7c60 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,9 @@ public class ExampleBot { @Override public void onFrame() { + // this object is ONLY valid while Mirror.startGame is running + // (which is fine 99% of the time, it just means you should only + // use it within code that is invoked from these listener methods) Game game = mirror.getGame(); Player self = game.self(); @@ -47,12 +50,16 @@ public class ExampleBot { } }); - // blocks indefinitely - mirror.startGame(); + // if you pass true, blocks indefinitely and keeps Broodwar instance + // connection to keep playing subsequent matches. + // if you pass false, startGame will return after a single match and + // disconnects from the Broodwar instance. you can call startGame as + // many times as you wish in this case. + mirror.startGame(true); } public static void main(String... args) { - new TestBot().run(); + new ExampleBot().run(); } } ```