Jump to content

If command help with pixelsearch


 Share

Recommended Posts

I'm trying to compose a script to search for a particular pixel color and right click on it, although from time to time, the color will not be available (this will be a normal activity since the pixel is available only at a certain time). whenever the pixel is not available, the script errors and stops, i tried to modify with an IF command but i couldnt figure it out. so basically i need a line saying if the coordinates of the pixel from the pixel search isnt available, that it will not try to mouseover (which is causing the error at the moment) thanks in advance.

-----------------------------------------------------------

WinWaitActive("World of Warcraft")

HotKeySet("{PAUSE}", "Start")
HotKeySet("!{PAUSE}","Quit")

TogglePause()

func Start()
    HotKeySet("{PAUSE}")
    HotKeySet("{PAUSE}", "TogglePause")
    ToolTip('Active - Alan Pwns Your Face',0,0)
    While 1
        Send("4")
        Sleep(1000)
        Global $coord = PixelSearch(0, 0, 1280, 768, 0x299FA5, 10)
        Global $coord2 = PixelSearch(0, 0, 1280, 768, 0x299FA5, 10)
        MouseMove($coord[0], $coord[1])
        Mouseclick ("right")
        MouseDown("left")
        MouseUp("left")
        Sleep(1000)
        MouseDown("right")
        MouseUp("right")
        Send("{Space}")
        Sleep(15000 + Random(5000, 15000, 1))
        Sleep(Random(12000,24000))
    WEnd
EndFunc

Func TogglePause()
    ToolTip('Inactive - I Still Pwn Your Face',0,0)
    HotKeySet("{PAUSE}")
    HotKeySet("{PAUSE}", "Start")
    While 1
        Sleep(100)
    WEnd
EndFunc

func Quit()
    Exit
EndFunc
Edited by Larry
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...