Jump to content

Trying to use IsArray to search for colors


Recommended Posts

I am trying to use IsArray(variable name) to search for colors, and then when they are found perform an action. The problem I am having is that only the first IsArray command is being executed. Here is my code

$ColorStart = PixelSearch(398, 140, 1505, 963, 0xB97231)
If IsArray($ColorStart) Then
    MouseClick("left", 1313, 764, 1)
EndIf
$ColorBattle = PixelSearch(826, 386, 1032, 772, 0x6D6D3A)
Sleep(10000)
If IsArray($ColorBattle) Then
    MouseClick("left", 933, 431, 1)
Else
    MouseClick("left", 930, 490, 1)
    EndIf

Only the first IsArray($ColorStart) is working. When it goes to IsArray($ColorBattle) even when I am 100% sure the color is present it goes to the else option. Please help me I am not sure how to make my second, third, fourth, etc IsArray(variable) to work.

Link to post
Share on other sites
Local $ColorStart = PixelSearch(398, 140, 1505, 963, 0xB97231)
If Not @error Then
    MouseClick("left", 1313, 764, 1)
    ;MouseClick("left", $ColorStart[0], $ColorStart[1], 1)
EndIf

Sleep(10000)
Local $ColorBattle = PixelSearch(826, 386, 1032, 772, 0x6D6D3A)
If Not @error Then
    MouseClick("left", 933, 431, 1)
    ;MouseClick("left", $ColorBattle[0], $ColorBattle[1], 1)
Else
    MouseClick("left", 930, 490, 1)
EndIf

 

Regards,
 

Link to post
Share on other sites

Welcome to AutoIt and the forum!
Out of curiosity: Which game do you try to automate?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

That's what I feared.
Looks like you missed to read the forum rules on your way in. Please do so now.
Game automation of any kind is not permitted here.

Hope to see you soon with a legitimate question :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
  • Jos locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...