However, it seems to be counting the amount of that item in my inventory but it is always 1 more than what there is.
This is what I have at the moment:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
CoordMode, Mouse, Window
SetTitleMatchMode, 1
#IfWinActive, RuneLite
IfNotExist, Counter
file := FileOpen(Counter, "w")
file.write(increment)
file.close()
increment := 0
Counter := "C:\Users\Callum\Documents\AHK\Counters\Counter.txt" ; put your path here
F12::
glob_List := ImageSearchList("C:\Users\Callum\Documents\AHK\AHK Images\Item.png",557,235,737,490,",","`n","f_MyDebug")
ToolTip
Loop, Parse, glob_List, `n
{
increment += 1
file:= FileOpen(Counter, "w")
file.write(increment)
file.close()
}
Return
ImageSearchList(p_ImgStr,p_StartX=0,p_StartY=0,p_EndX=0,p_EndY=0,p_CDelim=",",p_LDelim="`n",p_DebugFunc="")
{
l_Debug := IsFunc(p_DebugFunc) , l_StX := p_StartX , l_List := ""
p_EndX := ( !p_EndX ? A_ScreenWidth : p_EndX ) , p_EndY := ( !p_EndY ? A_ScreenHeight : p_EndY )
Loop
{
ImageSearch, l_OutX, l_OutY, %l_StX%, %p_StartY%, %p_EndX%, %p_EndY%, %p_ImgStr%
If l_Debug
%p_DebugFunc%(A_Index,l_OutX,l_OutY,l_StX,p_StartY,p_EndX,p_EndY,p_ImgStr,l_List)
If InStr( l_List , l_OutX p_CDelim l_OutY p_LDelim )
{
l_StX := l_OutX+1
Continue
}
If ( l_OutX="" || l_OutY="" )
If ( l_StX <> p_StartX )
{
l_StX := p_StartX , p_StartY++
Continue
}
Else
Break
l_List .= l_OutX p_CDelim ( p_StartY := l_OutY ) p_LDelim
}
Return l_List
}