Jump to content

Complile error:


lolp1
 Share

Recommended Posts

I belive this is based of larrys code, but I have ran into a compile error:

When I run this it runs fine:

Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

Global $pixel = Int(IniRead(".\PixelSearch.ini","Main","PixelColor","-1"))
Global $chksum = Int(IniRead(".\PixelSearch.ini","Main","PixelCheckSum","-1"))

If $pixel = -1 Or $chksum = -1 Then
    MsgBox(4096,"Error","Could not read INI")
    Exit
EndIf

$VIRTUALDESKTOPWIDTH = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALWIDTH)
$VIRTUALDESKTOPWIDTH = $VIRTUALDESKTOPWIDTH[0]
$VIRTUALDESKTOPHEIGHT = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALHEIGHT)
$VIRTUALDESKTOPHEIGHT = $VIRTUALDESKTOPHEIGHT[0]

HotKeySet("`","find")

While 1
    ToolTip("Press ` (Tilda key) to" & @LF & "find the area in PixelSearch.ini.")
    Sleep(100)
WEnd

Func find()
    $x = 0
    $y = 0
    $ypixel = $VIRTUALDESKTOPHEIGHT - 1
    While 1
        $xy = PixelSearch($x,$y,$VIRTUALDESKTOPWIDTH - 1,$ypixel,$pixel)
        If @error And $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)Then
            MsgBox(4096,"Error","Could not find area.")
            Exit
        ElseIf @error Then
            $y = $ypixel + 1
            $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)
            $x = 0
        ElseIf $chksum = PixelCheckSum($xy[0]-5,$xy[1]-5,$xy[0]+5,$xy[1]+5) Then
            Mousemove($xy[0],$xy[1])
            ToolTip("There it is.")
            Sleep(3000)
            Exit
        Else
            $y = $xy[1]
            $ypixel = $y
            $x = $xy[0] + 1
        EndIf
    WEnd
EndFunc

How ever when I run this:

Global Const $SM_VIRTUALWIDTH = 78
Global Const $SM_VIRTUALHEIGHT = 79

Global $pixel = Int(IniRead(".\PixelSearch.ini","Main","PixelColor","-1"))
Global $chksum = Int(IniRead(".\PixelSearch.ini","Main","PixelCheckSum","-1"))

If $pixel = -1 Or $chksum = -1 Then
    MsgBox(4096,"Error","Could not read INI")
    Exit
EndIf

$VIRTUALDESKTOPWIDTH = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALWIDTH)
$VIRTUALDESKTOPWIDTH = $VIRTUALDESKTOPWIDTH[0]
$VIRTUALDESKTOPHEIGHT = DLLCall("user32.dll","int","GetSystemMetrics","int",$SM_VIRTUALHEIGHT)
$VIRTUALDESKTOPHEIGHT = $VIRTUALDESKTOPHEIGHT[0]

HotKeySet("`","find")

While 1
    ToolTip("Press ` (Tilda key) to" & @LF & "find the area in PixelSearch.ini.")
    Sleep(100)
WEnd

Func find()
    $x = 0
    $y = 0
    $ypixel = $VIRTUALDESKTOPHEIGHT - 1
    While 1
        $xy = PixelSearch($x,$y,$VIRTUALDESKTOPWIDTH - 1,$ypixel,$pixel)
        If @error And $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)Then
            MsgBox(4096,"Error","Could not find area.")
            Exit
        ElseIf @error Then
            $y = $ypixel + 1
            $ypixel = ($VIRTUALDESKTOPHEIGHT - 1)
            $x = 0
        ElseIf $chksum = PixelCheckSum($xy[0]-5,$xy[1]-5,$xy[0]+5,$xy[1]+5) Then
            Mouseclick($xy[0],$xy[1])
            ToolTip("There it is.")
            Sleep(3000)
            Exit
        Else
            $y = $xy[1]
            $ypixel = $y
            $x = $xy[0] + 1
        EndIf
    WEnd
EndFunc

Note: The thing that changed was

Mousemove($xy[0],$xy[1])

To:

Mouseclick($xy[0],$xy[1])

When I run it I get this error:

Error: Incorrect number of parameters in function call.

Any advice?

Link to comment
Share on other sites

Try

Mouseclick("left",$xy[0],$xy[1])


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...