twig941

Trying to use IsArray to search for colors

6 posts in this topic

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

 


Regards,
 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Edited by water
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi I was trying to automate Adventure Quest just to see if I can do it.

 

Thanks your help the code works.

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 (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


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