Jump to content
Sign in to follow this  
wlimpoodey

PIxelsearch and loop

Recommended Posts

wlimpoodey

Hey there i just started playing around with Autoit, and i have decided to make just a little requeue bot for Global Agenda game. Anyway here's my code so far (i know its childish but i'm still learning)

Opt("WinWaitDelay",1000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Global Agenda","")

If Not WinActive("Global Agenda","") Then WinActivate("Global Agenda","")

WinWaitActive("Global Agenda","")

Send("m")

MouseMove(1300,283)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1287,794)

MouseDown("left")

MouseUp("left")

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

Sleep(186000)

Send("aaa")

Sleep(186000)

Send("sss")

Sleep(186000)

Send("ddd")

Sleep(186000)

Send("www")

Sleep(186000)

MouseMove(1120,952)

MouseDown("left")

MouseUp("left")

Note that the sleep function are used to time a 15.5 min timer for the missions to end.

Now what it does, Using my resolution of the game, it will press M to open missions, then click the medium difficulty mission, then click join.

So far this is working perfectly, Although there's a small problem, once queued the accept mission will pop, and there's no way of auto accepting it, so i have searched forums for a way to scan pixel, i did found some info but not exactly what i wanted

What i need:

The bot to search from 1100,381 To 1201,506 for the color #1b861b or 5,134,27Rgb (that color means a player accepted the mission)

If the bot finds it it would click the accept button at 1090,592 and if it did not found it, it would search again for it after 5 second (that until its found)

And then id need a function to loop :

Send("m")

MouseMove(1300,283)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1287,794)

MouseDown("left")

MouseUp("left")

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

Sleep(188000)

Send("aaa")

Sleep(188000)

Send("sss")

Sleep(188000)

Send("ddd")

Sleep(188000)

Send("www")

Sleep(188000)

MouseMove(1120,952)

MouseDown("left")

MouseUp("left")

I know there are some good Autoit guru out there, pls help :D thanks!

-jeep

Share this post


Link to post
Share on other sites
wlimpoodey

So you want PixelSearch() then. See helpfile.

Yes i looked at the help file although i do not understand how to make it click IF it found the color and if not to search again

So far all i was able to make is

$coord = PixelSearch( 1100, 381, 1201, 506, 0x05861B, 10 )

If Not @error Then

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

EndIf

Used 10 shades that should be fine but, i need something like,

If $coord is found then mouseover click etc etc, and if not search again in 5 seconds

Any idea on how i could make that?

Share this post


Link to post
Share on other sites
ForsakenGod

Yes i looked at the help file although i do not understand how to make it click IF it found the color and if not to search again

So far all i was able to make is

$coord = PixelSearch( 1100, 381, 1201, 506, 0x05861B, 10 )

If Not @error Then

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

EndIf

Used 10 shades that should be fine but, i need something like,

If $coord is found then mouseover click etc etc, and if not search again in 5 seconds

Any idea on how i could make that?

basically its simple :D

While 1
    $coord = PixelSearch( 1100, 381, 1201, 506, 0x05861B, 10 )
    If @error = 0 Then ;; if color found the do action
        MouseMove(1090,592)
        MouseDown("left")
        MouseUp("left")
    Else ;; if not wait 5 secs and repeat :)
        Sleep(5000)
    EndIf

Wend

Good luck

Share this post


Link to post
Share on other sites
wlimpoodey

basically its simple :D

While 1
    $coord = PixelSearch( 1100, 381, 1201, 506, 0x05861B, 10 )
    If @error = 0 Then ;; if color found the do action
        MouseMove(1090,592)
        MouseDown("left")
        MouseUp("left")
    Else ;; if not wait 5 secs and repeat :)
        Sleep(5000)
    EndIf

Wend

Good luck

Ahhh i was getting close haha thanks for the help and sharing you knowledge :huggles:

Share this post


Link to post
Share on other sites
ForsakenGod

Ahhh i was getting close haha thanks for the help and sharing you knowledge :huggles:

Np good luck :D

Share this post


Link to post
Share on other sites
wlimpoodey

Opt("WinWaitDelay",1000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Global Agenda","")

If Not WinActive("Global Agenda","") Then WinActivate("Global Agenda","")

WinWaitActive("Global Agenda","")

Send("m")

MouseMove(1300,283)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1287,794)

MouseDown("left")

MouseUp("left")

While 1

$coord = PixelSearch( 1093, 320, 1195, 505, 0x049A1D, 20 )

If @error = 0 Then

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

Else

Sleep(3000)

EndIf

Wend

Sleep(186000)

Send("aaa")

Sleep(186000)

Send("sss")

Sleep(186000)

Send("ddd")

Sleep(186000)

Send("www")

Sleep(186000)

MouseMove(1120,952)

MouseDown("left")

MouseUp("left")

Unfortunately the color scan does not work :S and i am absolutely sure my coord are right and i just checked again the color using photoshop and used 20 shades, any idea ?

Share this post


Link to post
Share on other sites
ForsakenGod

Unfortunately the color scan does not work :S and i am absolutely sure my coord are right and i just checked again the color using photoshop and used 20 shades, any idea ?

Try to do a quick debug :huggles: If color found let it print up for eq : an msg box if not let it do nothink and then move the color over the pixelsearch ull see the result :D

Share this post


Link to post
Share on other sites
wlimpoodey

Aiight just did with

Opt("TrayIconDebug", 1)

And it said

Line 25 Sleep(3000) so it basicly means the script is waiting forever and not searching over and over right?

Ive done it this way

While 1

$coord = PixelSearch( 1093, 320, 1195, 505, 0x049A1D, 20 )

If @error = 0 Then

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

Else

MsgBox(48, "aaaaaaa", "wwwwwww")

EndIf

Wend

It just spam a msg box wich means theres no problem until there but i think i'm missing a function or something to make it repeat the color search after waiting 3 sec

While 1

$coord = PixelSearch( 1093, 320, 1195, 505, 0x049A1D, 20 )

If @error = 0 Then

MouseMove(1090,592)

MouseDown("left")

MouseUp("left")

Else

Sleep(3000) ;; << like something here

EndIf

Wend

Edited by wlimpoodey

Share this post


Link to post
Share on other sites
ForsakenGod

Aiight just did with

Opt("TrayIconDebug", 1)

And it said

Line 25 Sleep(3000) so it basicly means the script is waiting forever and not searching over and over right?

Ive done it this way

While 1
     $coord = PixelSearch( 1093, 320, 1195, 505, 0x049A1D, 20 )
     If @error = 0 Then
         MouseMove(1090,592)
         MouseDown("left")
         MouseUp("left")
     Else
         MsgBox(48, "aaaaaaa", "wwwwwww")
     EndIf
Wend

It just spam a msg box wich means theres no problem until there but i think i'm missing a function or something to make it repeat the color search after waiting 3 sec
While 1
     $coord = PixelSearch( 1093, 320, 1195, 505, 0x049A1D, 20 )
     If @error = 0 Then
         MouseMove(1090,592)
         MouseDown("left")
         MouseUp("left")
     Else
         Sleep(3000) ;; << like something here
     EndIf
Wend

That means the color you are looking for is not there or your searching area is badly setted :D

Share this post


Link to post
Share on other sites
wlimpoodey

That means the color you are looking for is not there or your searching area is badly setted :D

I see, hmmm you have any tips on how to find right searching area and color besides taking a high rez screenshot from game and using photoshop cs3 ?

Share this post


Link to post
Share on other sites
ForsakenGod

I see, hmmm you have any tips on how to find right searching area and color besides taking a high rez screenshot from game and using photoshop cs3 ?

Autoit Window Info.exe < ----- :D:D

Share this post


Link to post
Share on other sites
bogQ

Note that your brakeing game Terms of Service and Privacy Policy

The following list of prohibited conduct is for illustrative purposes only and is a non-exhaustive list of potential violations of these Terms of Service. You will be deemed to have violated these Terms of Service if you (or others using your Account) do any of the following:

...

•Use or distribute "auto" software programs, "macro" software programs or other "cheat utility" software program or applications.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
wlimpoodey

ok now this is working

Opt("WinWaitDelay",1000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Opt("TrayIconDebug", 1)

WinWait("Global Agenda","")

If Not WinActive("Global Agenda","") Then WinActivate("Global Agenda","")

WinWaitActive("Global Agenda","")

Send("m")

MouseMove(1300,273)

MouseDown("left")

MouseUp("left")

Sleep(1000)

MouseMove(1287,784)

MouseDown("left")

MouseUp("left")

Sleep(500)

MouseDown("left")

MouseUp("left")

MouseMove(1090,582)

While 1

$coord = PixelSearch( 1158, 392, 1195, 505, 0x04931c, 20 )

If @error = 0 Then

MouseDown("left")

MouseUp("left")

Sleep(186000)

Send("aaa")

Sleep(186000)

Send("sss")

Sleep(186000)

Send("ddd")

Sleep(186000)

Send("www")

Sleep(186000)

MouseMove(1120,952)

MouseDown("left")

MouseUp("left")

Sleep(10000)

Else

Sleep(3000)

EndIf

Wend

But id just like to add a command line that will return script to line 8 over and over again until stopped

Edited by wlimpoodey

Share this post


Link to post
Share on other sites
wlimpoodey

OK lets say i get the pixelsearch to find my green pixel i am looking for, although sometimes player click decline (red) and the bot would have to click accept again so id need just the fucntion that would let me

While 1

$coord = PixelSearch( 1158, 392, 1195, 505, 0x04931c, 20 )

If @error = 0 Then

MouseDown("left")

MouseUp("left")

Exitloop

Else

Sleep(3000)

EndIf

Wend

But

If $coord = the red one, return to line "While 1"

any way of doing this ?

Share this post


Link to post
Share on other sites
SmOke_N

Thx i'm aware of that hhehe botted in wow, silroad, maple story, lotro, and now global :D its a part of my life ^^ too lazy to play :huggles:

Then you're probably aware that you're breaking ours.

Topic closed, do not start another thread.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.