diff --git a/rts.au3 b/rts.au3 index 4ea6276..50d36f2 100644 --- a/rts.au3 +++ b/rts.au3 @@ -1,15 +1,17 @@ #include "tolk.au3" -$watchlist="Output|Choices|Player|Monster|Relic|hand" - -$WindowList=StringSplit($watchlist, "|") -dim $OldText[$WindowList[0]] +$WindowList=FileReadToArray("watchlist.txt") +If @error then +Msgbox(16, "Error", "Couldn't read Watchlist. The file may either be empty, inaccessible or not exist.") +exit +EndIf +dim $OldText[UBound($WindowList)] Tolk_Load() if not Tolk_IsLoaded() then Msgbox(16, "Error", "Tolk failed to load!") exit EndIf func speak($text) -If $text>"" then tolk_output($text) +If $text>"" then tolk_output($text);Suppress blank lines because NVDA gets chatty endFunc func Quit() Speak("Exitting") @@ -17,15 +19,15 @@ exit EndFunc HotKeySet("^q", "Quit") while 1 -for $i=1 to $WindowList[0] step 1 +for $i=0 to UBound($WindowList)-1 step 1 $text=ControlGetText($WindowList[$i], "", "[CLASS:Edit]") -If $text <> $OldText[$i-1] then; speak the new text! +If $text <> $OldText[$i] then; speak the new text! Speak($WindowList[$i]);announce what window the output came from If $WindowList[$i]="Output" then ;The entire output Window should always be reread since that's generally requested by the player Tolk_Output($text) else ;For other windows, compare the old and newly changed text line by line to only anounce the ones that changed. -$OldArray=StringSplit($OldText[$i-1], @crlf, 1) +$OldArray=StringSplit($OldText[$i], @crlf, 1) $NewArray=StringSplit($text, @crlf, 1) For $i2=1 to $NewArray[0] step 1 If $i2