Jump to content

PixelSearch Multi - (Moved)


Recommended Posts

Hello guys i would like to Create a little easy BoT but i have a Tiny Problem.

I just want to Create a bot if i Press and Hold key x Down then search for a Pixel and  if the Pixel dosn't found he take the next one for 8 Times 

 

 

Iam a AutoIT Beginner :( i hope i dont Blame me :) 

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

HotKeySet ("{ENTER}", "Start")
HotKeySet ("{ESC}", "_Exit")

While 1
Sleep(250)
WEnd

Func Start()
$Color1 = 0xFF0000;Red
$Color2 = 0x00FF00;Green
While 1
    Sleep(100)
    $Search1 = Pixelsearch(0,0,@DesktopWidth,@DesktopHeight,$Color1)
    $Search2 = Pixelsearch(0,0,@DesktopWidth,@DesktopHeight,$Color2)
    If IsArray($Search1) AND Isarray($Search2) Then



        Exit
    EndIf
WEnd
EndFunc

Func _Exit()
Exit
EndFunc

 

I wanted to do so, if color 1 then a different function should be performed as if color 2 is active.

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

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

 

Link to comment
Share on other sites

AND Isarray($Search2)

Just remove that, if color 1 present it just continues.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Moderators

@Schneeflocke this is the second time you have posted something regarding game automation. You have been pointed to the forum rules already; do not post such a question again; our patience has its limits.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers

@Schneeflocke,

I will reopen this thread as you indicated in PM that is is not related to Game automation.
It wasn't too smart to simply reopen a new topic on the same subject as that is clearly prohibited by our forum rules and doesn't contribute to your credibility.

So lets restart all of this and ensure we stick to our rules. :)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos changed the title to PixelSearch for 8 Times ... ?
  • Jos unlocked and unlocked this topic

Hey Snowflake and everyone else,

I don't know if this will work, being that PixelSearch refuses to work for me. My implementation must be off (perhaps someone more qualified can point out my mistake). Here's  the code I threw together. It may give you a starting point.

HotKeySet ("{ENTER}", "Start")
HotKeySet ("{ESC}", "_Exit")

Global $iStartX = 0
Global $iStartY = 0
Global $iEndX = @DesktopWidth
Global $iEndY = @DesktopHeight

; Make sure the following arrays have the same amount of elements
Global $aKeyColor = [0x0000FF,0xFF0000,0xFFA500] ; Colors to check for: Green,Red,Orange (in hexadecimal)
Global $aKeyPress = ["#","#","#"] ; Keys to Press
Global $aKeyRepeat = [10,4,12] ; How many times to repeat Key Presses

Global $iMatch = UBound($aKeyColor)
If ($iMatch = UBound($aKeyPress) And $iMatch = UBound($aKeyRepeat)) Then ; Make sure all Key arrays match element counts
    While 1
        Sleep(50) ;Sleep Loop
    WEnd
Else
    MsgBox(16,"PixelTest","Key Arrays don't have same amount of elements!")
EndIf

Func Start()
    Local $iLoop
    While 1
        For $iCount = 0 To $iMatch-1
            Sleep(20)
            $aSearch = PixelSearch($iStartX,$iStartY,$iEndX,$iEndY,$aKeyColor[$iCount])
            If UBound($aSearch) = 2 Then
                For $iKeyRepeat = 1 To $aKeyRepeat[$iCount]
                    Send($aKeyPress[$iCount]) ; Send Keys to current window. You can also use ControlSend
                    Sleep(20) ; Pause in between key presses
                Next
            EndIf
        Next
    WEnd
EndFunc

Func _Exit()
    Exit 0
EndFunc

I truly hope it ISN'T used for game automation. Keep in mind I haven't touched AutoIt in three+ years, so I'm rusty.

Peace,

-Trystian

Link to comment
Share on other sites

There may be a much simpler way to do this. What is the name of the application you want to automate? I ask for many reasons:

  • There may be a script all ready to go for you to use in the forum.
  • Pixel searching is the worst way to automate and should ONLY be used as a last resort. 
  • Pixel searching is slower.
  • Pixel searching can easily fail due to things like losing window focus, slight changes to the GUI and so forth.

Happy to help

Link to comment
Share on other sites

Hello people I wanted to thank you for all the advice and currently test Trystians script.

 

 

How can you insert the individual sleep values?

 

On 27.7.2018 at 12:05 PM, Trystian said:

I truly hope it ISN'T used for game automation. Keep in mind I haven't touched AutoIt in three+ years, so I'm rusty.

and you can trust me i dont use it for games

Edited by Schneeflocke
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...