MasonMill Posted August 13, 2010 Share Posted August 13, 2010 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? Link to comment Share on other sites More sharing options...
targeter Posted August 13, 2010 Share Posted August 13, 2010 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. Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2010 Share Posted August 13, 2010 Global $Color[22] = ["B0171F", "DC143C", "FFB6C1", "etc..."] or Global $Color[22] $Color[0] = "DC143C" $Color[1] = "FFB6C1" $Color[2] = "FFB6C1" $Color[n] = "etc..." AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MasonMill Posted August 13, 2010 Author Share Posted August 13, 2010 Awesome, thanks! I was setting it up for a for loop, thats why i didnt do color1 and such. Link to comment Share on other sites More sharing options...
MasonMill Posted August 13, 2010 Author Share Posted August 13, 2010 After putting: Global $Color[22] $Color[0] = "DC143C" $Color[1] = "FFB6C1" $Color[2] = "FFB6C1" $Color[n] = "etc..." I get the same error Link to comment Share on other sites More sharing options...
targeter Posted August 13, 2010 Share Posted August 13, 2010 (edited) runs clean on my end.... not sure what is going on... Edited August 13, 2010 by targeter Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 13, 2010 Share Posted August 13, 2010 I get the same errorYou must still be doing it the wrong way. Post an example that shows us what you're doing. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
MasonMill Posted August 13, 2010 Author Share Posted August 13, 2010 here it is: expandcollapse popup#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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 13, 2010 Share Posted August 13, 2010 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
MasonMill Posted August 13, 2010 Author Share Posted August 13, 2010 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now