Unidentified syntax Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Guest

Unidentified syntax

26 Sep 2017, 01:24

Hello all,

I have this little problem with the following code.
I generated it with Pulover Macro creator, and it is functioning as intended over there.
However whenever I try to even run this script it gives me an error like this:

https://pasteboard.co/GM73Qf6.png

Code: Select all

F8::
Loop
{
WinActivate, BlueStacks
Sleep, 333
Loop
{
    CoordMode, Pixel, Window
    ImageSearch, FoundX, FoundY, 7, 38, 1114, 668, C:\Users\Morph\AppData\Roaming\MacroCreator\Screenshots\Screen_20170926074557.png
    CenterImgSrchCoords("C:\Users\Morph\AppData\Roaming\MacroCreator\Screenshots\Screen_20170926074557.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
}
Until ErrorLevel = 0
Loop
{
    CoordMode, Pixel, Window
    ImageSearch, FoundX, FoundY, 1, 0, 1118, 48, C:\Users\Morph\AppData\Roaming\MacroCreator\Screenshots\Screen_20170926080210.png
    CenterImgSrchCoords("C:\Users\Morph\AppData\Roaming\MacroCreator\Screenshots\Screen_20170926080210.png", FoundX, FoundY)
    If ErrorLevel = 0
    	Click, %FoundX%, %FoundY% Left, 1
}
Until ErrorLevel = 0
sleep, 70000
}
return
Is there any way to resolve this?

Thanks in advance.
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Unidentified syntax  Topic is solved

26 Sep 2017, 02:20

as the error says you are missing a function, here is one i think works for what your missing

Code: Select all

CenterImgSrchCoords(imagefile, ByRef FoundX, ByRef FoundY)
{
    static mypic
    Gui, imageDim: New
    Gui, imageDim:add, picture, vmypic, %imagefile%
    GuiControlGet, mypic, imageDim:Pos
    gui, imageDim:destroy
    
    FoundX += Floor(mypicW/2)
    FoundY += Floor(mypicH/2)
    return true
}
simply add that at the bottum of you AHK script and see if that helps...
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Unidentified syntax

28 Apr 2020, 10:48

this is an updated code ?
it fixes ErrorLevel = 0 after running this function

Code: Select all

CenterImgSrchCoords(File, ByRef CoordX, ByRef CoordY)
{
	static LoadedPic
	LastEL := ErrorLevel
	Gui, Pict:Add, Pic, vLoadedPic, %File% 
	GuiControlGet, LoadedPic, Pict:Pos
	Gui, Pict:Destroy
	CoordX += LoadedPicW // 2
	CoordY += LoadedPicH // 2
	ErrorLevel := LastEL
}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 69 guests