Jump to content

game script and pixel search


Daigtas
 Share

Recommended Posts

Hi everyone. Im new to auto it, but already like it.

So stright to my problem. Im building a game bot script. The game itself is based on flash so im using the pixelsearch function to find when the white color is gone then it shud do something. the problem is that im setting the coordinates of the pixelsearch (top-left corner and the bottum-right corner) and the variation of color as 1. the script seams to not see the very left side and the very right side. if anyone can suggest how to fix it or enchase the pixelsearch i wud be very grateful.

the script itself so far looks like that:

While 1
    $plude = PixelSearch(93, 295, 902, 533, 0xFFFFFF, 1)
if IsArray($plude) = True Then
        Sleep(2000)
    Else
        MouseMove(474, 588, 1)
        MouseClick("left",474, 588, 1)
        Sleep(3500)
        MouseMove(520, 450, 1)
        MouseClick("left", 520, 450, 1)
        MouseMove(474, 588, 1)
        MouseClick("left",474, 588, 1)
        Sleep(1500)
    EndIf
WEnd

as you can see the code is endless loop (that is the idea).

Btw the main window of the flash game is movable, like in farmville, but the window where i am searching is the modal window inside(!) the game, so i cannot embed it. I cud get the flash vars there is some ingame vars and all the info as i can see is send as xml data.

If i cud catche the xml response data and extract exact data in seconds from this:

<wait t="382">a32e292efe3bb0abacc67dc7782a0945</wait>

t="382" is the time, the next the next request hash. That way i wont nedd the PixelSearch function anymore. Just checking regulary the data inside this and setting the timer with it.

One more thing, what function is to make a gui mode window to set variables. I am planning to make a gui window to set coordinates of the window becouse if i move the window it messes up the coords and the script does not work. I think i cud make an auto search of the window origins (to find the corrners of it and automaticly adjust the coords. The trickiest part is pixelsearch so far, the rest is the time to read all the documentation of scripting and learn with all of you guys ;)

Thanks for any advice :idiot: ( btw, did i mention that im new to AutoIt scripting?:) )

Link to comment
Share on other sites

Forgot to mention, that the gui window for setting the coordinates shud be with buttons that when i press it it shud wait for next click, then when the user press it it shud promt a window with coordinates that the mouse was clicked and ask him is this ok or he wants to try again and change it. To tricky for me, i started to use this scripting just last night. :) thanks again for any advice ;)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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