MegaMek mm = new MegaMek(frame); mm.client = BotFactory.getBot(type,frame, name);
MegaMek mm = new MegaMek(); mm.client = BotFactory.getBot(type, name);
  public void run() {    boolean die = false;    try {      MegaMek mm = new MegaMek(frame);      mm.client = BotFactory.getBot(type,frame, name);      if(!mm.client.connect("localhost", 2348)) {        return;      }      sleep(500);      mm.client.retrieveServerInfo();      /*File f = new java.io.File("d:/Projects/megamek/data/mep/");      File[] reqs = f.listFiles(new FilenameFilter() {        public boolean accept(File dir, String name) {          return name.endsWith(".MEP");        }      });      f = reqs[Compute.randomInt(reqs.length)];      Mech mech = new MepFile(f.getAbsolutePath()).getMech();*/      //Mech mech = new MepFile("d:/Projects/current_megamek/data/mep/more/EXT-4A Exterminator.MEP").getMech();      //Mech mech = (Mech)(new BLKMechFile("d:/Projects/current_megamek/data/blk/Warhammer WHM-6K.blk").getEntity());      //Mech mech = new MepFile("d:/Projects/current_megamek/data/mep/ASN-21 Assassin.MEP").getMech();            // um, this is sure to fail...      Mech mech = null;            mech.setOwner(mm.client.getLocalPlayer());      mm.client.sendAddEntity(mech);      mm.client.sendAddEntity(mech);      mm.client.sendAddEntity(mech);      sleep(500);      mm.client.getLocalPlayer().setStartingPos(location);      mm.client.sendPlayerInfo();      sleep(500);      this.result = mm;      //result.client.sendReady(true);    } catch (Exception e) {      e.printStackTrace();    }    while (!die) {      try {        sleep(2000);        if (((BotClientWrapper)result.client).winner == -1 || ((BotClientWrapper)result.client).winner == 1) {          die = true;        }      } catch (Exception e) {}    }  }