Jump to content

Proper PixelSearch Syntax?


Glyph
 Share

Recommended Posts

CODE

$8=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '8', 'Value not found' ))
$9=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '9', 'Value not found' ))
$10=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '10', 'Value not found' ))
$11=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '11', 'Value not found' ))
$12=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '12', 'Value not found' ))
$13=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '13', 'Value not found' ))
$14=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '14', 'Value not found' ))
$15=(IniRead( @ScriptDir & '\Settings.ini', 'HexCode', '15', 'Value not found' ))
$game=(IniRead( @ScriptDir & '\Settings.ini', 'Game', '16', 'Value not found!!' ))

HotKeySet ( "^+e" , "Quit" );Control+shift+e = QuitQ
AutoItSetOption ( "PixelCoordMode",0 );search area of active wiundow

Func Quit()
exit
endfunc

$Res = Msgbox(3,"Run resolution?","Click 'Yes' to run at 800x600 or 'No' to run 1024x768, Click 'Cancel' to run 1280x1024")

If $res = 6 Then
 AdlibHandler800x600()
 ElseIf $res = 7 Then
AdlibHandler1024x768()
 ElseIf $res = 2 Then
AdlibHandler1280x1024()
EndIf

Func AdlibHandler800x600()
    AdlibEnable("AdlibHandler800x600",100)
    Char1()
    Char2()
    Char3()
    Char4()
    Char5()
    Char6()
    Char7()
    Char8()
EndFunc


While 1
    sleep(100)
WEnd


Func Char1()
PixelSearch(410, 310, 390, 290, $8, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

EndIf
EndFunc

Func Char2()
PixelSearch(410, 310, 390, 290, $9, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char3()
PixelSearch(410, 310, 390, 290, $10, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char4()
PixelSearch(410, 310, 390, 290, $11, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char5()
PixelSearch(410, 310, 390, 290, $12, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char6()
PixelSearch(410, 310, 390, 290, $13, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char7()
PixelSearch(410, 310, 390, 290, $14, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char8()
PixelSearch(410, 310, 390, 290, $15, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

;~ 1024x768 Mode! ===========================================================

Func AdlibHandler1024x768()
    AdlibEnable("AdlibHandler1024x768",100)
    Char9()
    Char10()
    Char11()
    Char12()
    Char13()
    Char14()
    Char15()
    Char16()
EndFunc

While 1
    sleep(100)
WEnd



Func Char9()
PixelSearch(522, 394, 502, 374, $8, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

EndIf
EndFunc

Func Char10()
PixelSearch(522, 394, 502, 374, $9, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char11()
PixelSearch(522, 394, 502, 374, $10, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char12()
PixelSearch(522, 394, 502, 374, $11, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char13()
PixelSearch(522, 394, 502, 374, $12, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char14()
PixelSearch(522, 394, 502, 374, $13, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char15()
PixelSearch(522, 394, 502, 374, $14, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char16()
PixelSearch(522, 394, 502, 374, $15, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc


;~ 1280x1024 Mode! ===========================================================

Func AdlibHandler1280x1024()
    AdlibEnable("AdlibHandler1280x1024",100)
    Char17()
    Char18()
    Char19()
    Char20()
    Char21()
    Char22()
    Char23()
    Char24()
EndFunc

While 1
    sleep(100)
WEnd



Func Char17()
PixelSearch(650, 522, 630, 502, $8, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

EndIf
EndFunc

Func Char18()
PixelSearch(650, 522, 630, 502, $9, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char19()
PixelSearch(650, 522, 630, 502, $10, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char20()
PixelSearch(650, 522, 630, 502, $11, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char21()
PixelSearch(650, 522, 630, 502, $12, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char22()
PixelSearch(650, 522, 630, 502, $13, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char23()
PixelSearch(650, 522, 630, 502, $14, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

Func Char24()
PixelSearch(650, 522, 630, 502, $15, 10)
If Not @error Then
MouseDown("left")
Sleep(100)
MouseUp("left")

endif
EndFunc

I can't see what's the matter here....

Logic looks good, No Errors, Just doesnt Mouseclick when it sees the color, im testing white and my desktop... doesnt do anything...

in the INI file the hex codes are set up properly eg. 0xFFFFFF, Whatever is the matter here is over my head.. i've done everything i can think of...

If anyone can help me i'de really appreciate it!

Edited by backstabbed

tolle indicium

Link to comment
Share on other sites

You need to move the mouse to the spot. The PixelSearch function returns an array of 2 elements. The first one is X, and the second one is Y.

Func Char22()
$Coords = PixelSearch(650, 522, 630, 502, $13, 10)
If @error Then Return
MouseMove ($Coords[0], $Coords[1], 0) ;X and Y, 0 is the speed (instantly)
MouseDown("left")
Sleep(100)
MouseUp("left")
EndFunc

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

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...