Jump to content
Sign in to follow this  
pepsip77

Multi pixelsearch

Recommended Posts

pepsip77

Hello, recently i've started codin in Autoit and I met some problems. I want to make bot, that checks 4 spaces for equal pixels, and if all pixels found it continues work. ButI'm gettin problems, while starting program. Help please

hotkeyset("{F5}","start")
hotkeyset("{F6}","stop")
While 1
   sleep(100)
   WEnd
  Global $On=0
  
   Func start()
   while 1
   $pixel1 = PixelSearch(867,343,889,359, 0x7F7B76)
   $pixel2 = PixelSearch(908,343,930,359, 0x0165B5E)
   $pixel3 = PixelSearch(949,343,971,359, 0x7F7B76)
   $pixel4 = PixelSearch(990,343,1012,359, 0x0165B5E)
   $knife = PixelSearch(995,559,1009,575, 0x79706F)
   $shaft = PixelSearch(388,533,411,563, 0x583509)
   $x10 = PixelSearch(335,567,413,577, 0xEEE5C6)
   $tree = PixelSearch(305,127,817,459, 0x78804F)
   If IsArray($pixel1) = True Then
      MouseMove($pixel1 [0], $pixel1 [1],1)
      MouseClick('left',$pixel1 [0], $pixel1 [1],1)
      $On=$On + 1
      Sleep(20)
   EndIf
    If IsArray($pixel2) = True Then
      MouseMove($pixel2 [0], $pixel2 [1],1)
      MouseClick('left',$pixel2 [0], $pixel2 [1],1)
      $On=$On + 1
      Sleep(20)
   EndIf
    If IsArray($pixel3) = True Then
      MouseMove($pixel3 [0], $pixel3 [1],1)
      MouseClick('left',$pixel3 [0], $pixel3 [1],1)
      $On=$On + 1
      Sleep(20
   EndIf
    If IsArray($pixel4) = True Then
      MouseMove($pixel4 [0], $pixel4 [1],1)
      MouseClick('left',$pixel4 [0], $pixel4 [1],1)
      $On=$On + 1
      Sleep(20)
   EndIf
  
   If $On=4 Then
     
   MouseMove($knife [0], $knife [1],1)
      MouseClick('left',$knife [0], $knife [1],1)
      Sleep(600)
  
   MouseMove($pixel1 [0], $pixel1 [1],1)
      MouseClick('left',$pixel1 [0], $pixel1 [1],1)
      Sleep(800)
      MouseMove($shaft [0], $shaft [1],1)
      MouseClick('right',$shaft [0], $shaft [1],1)
       MouseMove($x10 [0], $x10 [1],1)
      MouseClick('left',$x10 [0], $x10 [1],1)
   EndIf
   WEnd
   EndFunc
  
    Func stop()
   Exit
   EndFunc

Share this post


Link to post
Share on other sites
guinness

If this is for a game then my advice would be to read the Forum Rules first.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


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

×