Jump to content
Sign in to follow this  
MasonMill

Colors array

Recommended Posts

MasonMill

Hey Guys,

I have a list of colors like this:

Global $Color[0] = "B0171F"

Global $Color[1] = "DC143C"

Global $Color[2] = "FFB6C1"

Global $Color[3] = "EE3A8C"

Global $Color[4] = "CD3278"

Global $Color[5] = "8B2252"

Global $Color[6] = "EE30A7"

Global $Color[7] = "CD2990"

Global $Color[8] = "8B1C62"

Global $Color[9] = "FF00FF"

Global $Color[10] = "EE00EE"

Global $Color[11] = "CD00CD"

Global $Color[13] = "B23AEE"

Global $Color[14] = "7D26CD"

Global $Color[15] = "0000CD"

Global $Color[16] = "00008B"

Global $Color[17] = "000080"

Global $Color[18] = "1C86EE"

Global $Color[19] = "00B2EE"

Global $Color[20] = "00E5EE"

Global $Color[21] = "00EE76"

and I am getting an error:

C:\Users\Mason\Desktop\scripts\colorArray.au3(75,28) : ERROR: syntax error

Global $Color[0] = "B0171F"

~~~~~~~~~~~~~~~~~~~~~~~~~~~^

why is ths?

Share this post


Link to post
Share on other sites
targeter

Hey Guys,

I have a list of colors like this:

Global $Color[0] = "B0171F"

Global $Color[1] = "DC143C"

Global $Color[2] = "FFB6C1"

Global $Color[3] = "EE3A8C"

Global $Color[4] = "CD3278"

Global $Color[5] = "8B2252"

Global $Color[6] = "EE30A7"

Global $Color[7] = "CD2990"

Global $Color[8] = "8B1C62"

Global $Color[9] = "FF00FF"

Global $Color[10] = "EE00EE"

Global $Color[11] = "CD00CD"

Global $Color[13] = "B23AEE"

Global $Color[14] = "7D26CD"

Global $Color[15] = "0000CD"

Global $Color[16] = "00008B"

Global $Color[17] = "000080"

Global $Color[18] = "1C86EE"

Global $Color[19] = "00B2EE"

Global $Color[20] = "00E5EE"

Global $Color[21] = "00EE76"

and I am getting an error:

C:\Users\Mason\Desktop\scripts\colorArray.au3(75,28) : ERROR: syntax error

Global $Color[0] = "B0171F"

~~~~~~~~~~~~~~~~~~~~~~~~~~~^

why is ths?

You are actually going to get that error with any of the colors, did you define the array? I mean you could just do

Global $color1 = "00EE76" without any errors.

Share this post


Link to post
Share on other sites
MasonMill

Awesome, thanks! I was setting it up for a for loop, thats why i didnt do color1 and such.

Share this post


Link to post
Share on other sites
MasonMill

After putting:

Global $Color[22]

$Color[0] = "DC143C"

$Color[1] = "FFB6C1"

$Color[2] = "FFB6C1"

$Color[n] = "etc..."

I get the same error

Share this post


Link to post
Share on other sites
targeter

runs clean on my end.... not sure what is going on...

Edited by targeter

Share this post


Link to post
Share on other sites
MasonMill

here it is:

#AutoIt3Wrapper_run_debug_mode=Y

Global $Color[52]
Global $Color[0] = "B0171F"
Global $Color[1] = "DC143C"
Global $Color[2] = "FFB6C1"
Global $Color[3] = "EE3A8C"
Global $Color[4] = "CD3278"
Global $Color[5] = "8B2252"
Global $Color[6] = "EE30A7"
Global $Color[7] = "CD2990"
Global $Color[8] = "8B1C62"
Global $Color[9] = "FF00FF"
Global $Color[10] = "EE00EE"
Global $Color[11] = "CD00CD"
Global $Color[13] = "B23AEE"
Global $Color[14] = "7D26CD"
Global $Color[15] = "0000CD"
Global $Color[16] = "00008B"
Global $Color[17] = "000080"
Global $Color[18] = "1C86EE"
Global $Color[19] = "00B2EE"
Global $Color[20] = "00E5EE"
Global $Color[21] = "00EE76"
Global $Color[22] = "00CD66"
Global $Color[23] = "008B45"
Global $Color[24] = "00EE00"
Global $Color[25] = "00CD00"
Global $Color[26] = "008B00"
Global $Color[27] = "FFFF00"
Global $Color[28] = "EEEE00"
Global $Color[29] = "CDCD00"
Global $Color[30] = "8B8B00"
Global $Color[31] = "DAA520"
Global $Color[32] = "CD9B1D"
Global $Color[33] = "EE9A00"
Global $Color[34] = "EE7600"
Global $Color[35] = "EE4000"
Global $Color[36] = "EE5C42"
Global $Color[37] = "B22222"
Global $Color[38] = "FF3030"
Global $Color[39] = "EE2C2C"
Global $Color[40] = "CD2626"
Global $Color[41] = "FF0000"
Global $Color[42] = "EE0000"
Global $Color[43] = "CD0000"
Global $Color[44] = "8B0000"
Global $Color[45] = "800000"
Global $Color[46] = "8E388E"
Global $Color[47] = "7171C6"
Global $Color[48] = "7D9EC0"
Global $Color[49] = "388E8E"
Global $Color[50] = "71C671"
Global $Color[51] = "8E8E38"

Global $Threshold = 20


HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{END}", "Terminate")
HotKeySet("{F1}", "FindColor")

Func FindColor()

    For $i = 0 To 51 Step 1
            $aColor = PixelSearch(200, 20, 400, 400, 0x & $Color[$i] & "", $Threshold)

            If IsArray($aColor) Then
                    MsgBox("", "Report", "Color found!")
            EndIf
    Next

EndFunc

Share this post


Link to post
Share on other sites
AdmiralAlkex

Only put Global on the declaration, not the assignment (right words?). So make it exactly like JohnOne said:

Global $Color[22]

$Color[0] = "DC143C"

$Color[1] = "FFB6C1"

$Color[2] = "FFB6C1"

etc.

And it will work.

Also, did you know there's a tutorial about arrays in the wiki? You may want to check it out. Link.

Share this post


Link to post
Share on other sites
MasonMill

ooooooooooo gotcha! And i didnt know there was a tutorial there, ill go check it out. Im good with graphics and such, its the arrays that get me. Thanks guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.