[Pogamut-list] Run bot from command line
cazub
pogamut-forum at artemis.ms.mff.cuni.cz
Sat Oct 25 21:35:10 CEST 2008
Re: Re: Re: Run bot from command line
Hey Schrum2 sorry for no posting, I'll post my code below but again i've only been able to get a single bot running remotley at a time. If you want that code here ya go!
//----------------
public class launcher {
public static void main(String[] args) throws URISyntaxException {
//create new URI using first command line argument
java.net.URI gameBots = new URI(args[0]);
//error check, make sure user actually typed URI at command line
if(gameBots.getPath().equalsIgnoreCase("")){
System.out.println("no path set");
}
//error check, did user type a name at command line
if(args[1] == null){
System.out.println("no name set");
}
//get the name of the bot from second command line argument
String str = new String(args[1]);
bot mybot = new bot();
// the 'true' in the constructor is needed no matter what it seems
AgentLauncher launcher = new AgentLauncher(mybot, gameBots, true);
launcher.launch(); // launches bot
launcher.getAgent().getBody().configureName(str); //sets name of bot
}
//----------------------
then my command to start this would be
commandline#: java -cp . -jar MyLauncher.jar ut://192.168.2.4:3000 BotName1
Jakub says the ut:// part gets ignored but i have to put that in to get it to work for some reason. What i do is put that the "commandline" part above into 4 diffrent .bat files to run 4 bots, can't figure out running a batch from one program yet, it seems like it would be straight forward but i think i'm missing something.
----
Reply Link: <http://artemis.ms.mff.cuni.cz/pogamut/tiki-view_forum_thread.php?forumId=6&comments_reply_threadId=334&comments_parentId=207&post_reply=1#form>
More information about the Pogamut-list
mailing list