The script checks to see if a game windows is active, setups a key to press to start the script (and another to reload it). It then checks for an icon on the screen.
It then goes in to a loop reading a file and looking for a particular string and number. If it finds the number it executes a number of actions. The script works up to this point
If it does not find the string it should execute the else clause (and run that clause until it matches the IF clause). This is where it is breaking down and complaining about no matching IF for the ELSE. I've put the ELSE part where I believe it should go and as far as I can tell all the brackets match up. Where should the else part of the script go so the will loop and run properly ?
Code: Select all
#IfWinActive, Game Name
\::reload
$[::
loop
{
pixelGetColor, pixel1, 282, 56, RGB ;this is the grace period icon. It will appear to the right of any skill icon or by itself if no other character skills icons
sleep 530
if pixel1 = 0xFCD79D
{
{
FilePath := A_ScriptDir "\Client.txt" ; relative path to file
;MsgBox %A_ScriptDir%
File := FileOpen(FilePath, "r")
OldLogFileSize := 0
File.Seek(0, 2) ; move the file pointer to the end of the file to start reading newly added lines
Loop
{
LogFileSize := File.Length
if (LogFileSize > OldLogFileSize)
{
Loop
{
if File.AtEOF
Break
TextLine := File.Readline()
If InStr(TextLine, "seed") ;searching for keyword
{
RegExMatch(TextLine, "\bseed\s+\d*\K00$", RFNum) ;find keyword then match 00 at the end of the number after keyword
If RFNum = 00
{
MsgBox, % "The Seed Number matches ! " RFNum ; Display number. Change this to action once working
run, C:\AHk\Scripts\English.mp3 ; play specific alert sound
pause
}
}
}
else
click, 1816, 1032 ;world map co-ordinates in select world area
sleep 500
send ^{click, 654, 647} ;ctrl+click for new instance
sleep 500
click, 781, 698 ;select instance menu
sleep 400
OldLogFileSize := LogFileSize
}
Sleep, 1000 ; wait one second before checking again (change to whatever)
}
}
}
return