Jump to content

Trying to use IsArray to search for colors


twig941
 Share

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 comment
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 comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.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 (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.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 (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

@twig941 water is quite right. Please review the forum rules before posting again.

"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

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...