Oh here is the script i tried to make.
Here is how it works.
1) Checks log file size.
2) If higher than 0 then proceed
3) It gets the contents of the log file
4) Rewrites the log files (deletes every thing inside it)
I did this because i coudnt think if anything better is less time.
It scans only one message at a time.
5) then it checks wheather it is a shout or a private message (tell)
other things can be understood.
Code:
program New;
var
FileNum, LogSize :Integer;
TempS, TempMsg :String;
Procedure phrase_log;
Begin
ReadFileString(FileNum, TempS, LogSize);
CloseFile(FileNum);
CloseFile(RewriteFile('C:\Program Files\daimonin\daimonin_widget\Rosey.chat.log', False ));
writeln(TempS)
end;
procedure chk_log;
var a :integer;
Name, TimeStamp, PlyrMsg :String;
Begin
FileNum:= OpenFile( 'C:\chat.log' , False );
LogSize:= FileSize( FileNum )
If ( LogSize > 0 ) Then
Begin
phrase_log;
If (pos(' tells you:' , TempS) > 0) then
begin
a:= pos(' tells you:' , TempS);
TimeStamp := copy(TempS, 1, 17);
Name:= Copy(TempS, 20, (a-20) );
PlyrMsg:= Between(' tells you: ', #13#10, TempS)
WriteINI('Player_Data', Name, TimeStamp, ScriptPath + 'PlayerData.ini');
end else
If (pos(' shouts:' , TempS) > 0) then
begin
a:= pos(' shouts:' , TempS);
TimeStamp := copy(TempS, 1, 17);
Name:= Copy(TempS, 20, (a-20) );
PlyrMsg:= Between(' tells you: ', #13#10, TempS)
WriteINI('Player_Data', Name, TimeStamp, ScriptPath + 'PlayerData.ini');
end;
end;
end;
begin
chk_log;
end.
Log File: Example
Code:
01-01-97 01:45:10: Crazygeneral shouts: wb Rosey
01-01-97 01:44:45: player shouts: message 2
01-01-97 01:40:56: testplayer tells you: private message 3
01-01-97 01:35:42: sheepy tells you: private message 4
Now the problem is the game client locks the logfile
That means i cant write to it while the game is running.
Any code which only scans the last line of the log file or something like that.
Anyone has better ideas?
Sry Drunkenoldma, I forgot to tell you about the "shout" and "tell" messages.