PDA

View Full Version : Read Server Chat in Script?


TheEnlightenedFlorist
06-24-2011, 01:54 AM
Does anybody know how to access the chat logs from a script? I tried registering a method with the GameDef.Chat delegate, but that doesn't seem to work. Maybe it's for sending messages? Anyway, it would be really nice to be able to read player chat from a script. There's a lot of possibilities there.

Ataros
06-24-2011, 10:54 AM
I was told that time of writing a server log file was reduced in recent beta. Parsing the log file is one of obvious but not very elegant ways I think.

On the other hand the content of a log file is created by a code that watches for game events and outputs them to logfile. You can write a similar code that would watch game events and output all needed data not to logfile but to your code directly I guess.

TheEnlightenedFlorist
06-24-2011, 11:02 PM
Hi Ataros, you are right. That would not be a very elegant solution. You are also right that I need some way to listen for the event. Unfortunately, I do not know how to do that. It is easy to override the OnAircraftLanded() method to listen to that event, but there is no OnChat() method or anything similar.

Ataros
06-25-2011, 02:18 PM
What kind of events do you want to read from chat?

TheEnlightenedFlorist
06-25-2011, 11:03 PM
I want to be able to read what players write in the chat bar. I was thinking of making a mission where players could type a command into the chat bar and receive a mission to complete. Maybe ferrying an aircraft from one airbase to another or performing recon over an enemy position. Things like that.

Ataros
06-26-2011, 11:11 AM
I want to be able to read what players write in the chat bar. I was thinking of making a mission where players could type a command into the chat bar and receive a mission to complete. Maybe ferrying an aircraft from one airbase to another or performing recon over an enemy position. Things like that.

Asked the devs how to do it http://www.sukhoi.ru/forum/showthread.php?t=68629&p=1644944&viewfull=1#post1644944

They said before that you can compile a dll with a user interface and it will be downloaded from the server. Maybe it would be easier to make such a dll that would intercept keyboard commands. Then a player would just press a number key to select a line from menu.

TheEnlightenedFlorist
06-27-2011, 12:54 AM
Thanks Ataros. Hopefully, there's a better way. I don't know anything about WPF. :)