[Pogamut-list] Death Location - HeatMap
cazub
pogamut-forum at artemis.ms.mff.cuni.cz
Fri Apr 3 02:11:49 CEST 2009
Re: Death Location - HeatMap
Author: cazub
Figured it out after diggin through the library, my new code for anybody else that needs this:
//=============
public void receiveMessage(RcvMsgEvent e) {
//MessageObject temp = e.getMessage();
//must re-init here, bot is dead , restart it all
gotKill = true;
playerName = e.getMessage().UnrealID;
msg = e.getMessage().toString();
parseKiller();
}
public void parseKiller(){
String delim = ":"; //i think i can then parse this bad boy into only 3 chunks
String[] tokens = msg.split(delim);
// want the very first part of token 3
String tmp = tokens[2];
delim = ",";
String[] tokens2 = tmp.split(delim);
tmp = tokens2[0];
String tmp2 = tmp.replace(" ", ""); //strip whitespace
killerID = Integer.parseInt(tmp2);
}
}
//==============
if you dig through the code the PlayerKilledType.class gets the killer id info and some other info from the gamebots KIL message, but the RcvMsgListener doesn't really allow us to get to that attribute. So instead i use
e.getMessage(); , and then parsed the string to bits until i got the killer ID.
More information about the Pogamut-list
mailing list