Jump to content
twig941

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.

Share this post


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

 

Share this post


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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


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 (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


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

×
×
  • Create New...