Jump to content
JanqeD1337

ImageSearch/PixelSearch - (Locked)

Recommended Posts

Hey everyone, I apologize if in the wrong place. Was a few general options so wasn't exactly positive. If I am Just advise and I can post elsewhere. So I am completely new to Autoit. Been spending lots of the quarantine learning new languages. I'm pretty good with Javascript, C++, C#, Python but never messed with Autoit. Anyway, the thing I'm running into here is the ImageSearch/PixelSearch. Not sure if there is a better way to make these more useful for me.

I've attached an image to the post to demonstrate what I'm trying to match up with. I've tried both Pixel and Image to accomplish the goal. Pixel actually doesn't have any issue finding an acceptable color however, I need it to be like a 10px-10px opening for unit placement it's finding small gaps where units can't be placed. So I figure this is where image would come in but the only time I have luck with that is if the image is if I select 1 portion of the pattern in the image but then it's too large and if other units are in the way it will simply state not found. Is there a better way to use pixel or image to find an appropriate area that I want the mouse to drag to? Code is below. Maybe a suggestion on another method of doing this?

The light green(image example) is where you can place units. As you can see all the little sprites are characters already placed. My bot already checks if a unit is available (in the bottom) then it scans for a location to put it (and fails) however it does grab the character and drags it but not in a valid location then it returns by pressing the home button. This is a PVE game where you just play vs NPCs characters like a raid.You can place 1 unit with your team every 5 minutes so trying to automate this portion.

 

Below function is only for the locate light green area.

func unitFind()
;   $result = PixelSearch(430, 369, 1546, 718, 0x136F73, 0)
    $picture = "C:\Users\Jcape\Documents\RaidBot\img\validBF.png"
    $result = _ImageSearch_Area($picture, 488, 326, 1544, 759)
    if Not @error then
        MouseMove(261, 967, 50)
        MouseDown("LEFT")
        Sleep(200)
        MouseMove($result[1], $result[2], 50)
        MouseUp("LEFT")
    EndIf
EndFunc

image.thumb.png.7036de261135aefecf0fc9f55f50d838.png1590267944023.png.f902b895b8d22b59640ff9126f76e521.png

Share this post


Link to post
Share on other sites

I think I seen a rule saying we can't ask about games so I apologize. My question is for a game based solution but generally I would like the answer of how to best get more accurate selections if there are any tips. If neither is allowed feel free to delete! Thanks!

Share this post


Link to post
Share on other sites

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...