Flexist

Minecraft chat reader

Dec 19th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 0.68 KB | Source Code | 0 0
  1. CountLines() {
  2.     LogFilePath := A_AppData "\.minecraft\logs\latest.log"    ;---- Counts how many lines there and, used to read the very last and therefor, most recent line in Chat.
  3.     Loop, Read, %LogFilePath%              
  4.         lineCount++
  5.     return lineCount
  6. }
  7. ReadChat() {
  8.     LogFilePath := A_AppData "\.minecraft\logs\latest.log"
  9.     Num := CountLines()
  10.     FileReadLine, ChatMessage, %LogFilePath%, %Num% ;--- Reads last line in Minecraft's latest.log file
  11.     if InStr(ChatMessage, "[CHAT]") {
  12.         ChatMessage := RegExReplace(ChatMessage, ".*: \[CHAT\] ", "")  ;--- Cuts out all the unnecessary info
  13.         ChatMessage := RegExReplace(ChatMessage, "§[0-9a-fr]", "")
  14.     }
  15. return ChatMessage
  16. }
Advertisement
Add Comment
Please, Sign In to add comment