need help with reading minecraft chat

Ask gaming related questions (AHK v1.1 and older)
LasagnenFighter
Posts: 9
Joined: 27 Nov 2021, 19:37

need help with reading minecraft chat

25 Dec 2021, 08:48

Hey, im currently trying to make a script that reads the minecraft chat, and if the keyword "reset" comes, it presses y and 30 seconds after that o. This is the log file path:C:\Users\Henry\AppData\Roaming\minecraft\mods2\logs\latest.log
User avatar
YoucefHam
Posts: 372
Joined: 24 Aug 2015, 12:56
Location: Algeria
Contact:

Re: need help with reading minecraft chat

02 Jan 2022, 22:46

Hi there, drop a sample from the log file.
:wave: There is always more than one way to solve a problem. ;)
User avatar
mikeyww
Posts: 27271
Joined: 09 Sep 2014, 18:38

Re: need help with reading minecraft chat

03 Jan 2022, 09:38

Code: Select all

#Persistent
log  = %A_AppData%\minecraft\mods2\logs\latest.log
word = reset
If !FileExist(log) {
 MsgBox, 48, Error, File not found. Aborting. `n`n%log%
 Return
} Else SetTimer, Check, 1000
Check:
FileGetTime, modTime, % (log, lastModTime := modTime)
If (modTime = lastModTime)
 Return
FileRead, logText, %log%
lastPos := pos, pos := RegExMatch(logText, "is).*\K\b" word "\b")
If !pos || pos <= lastPos
 Return
Send y
SoundBeep, 1500
Sleep, 30000
Send o
Return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 29 guests