Bixby Sayz Posted December 8, 2013 Share Posted December 8, 2013 Pretty sure this can't be done, but never hurts to ask. If you had a string containing a color constant such as 'clWhite' is there a way to somehow turn that string into its actual integer value (16777215)? Quote Link to comment Share on other sites More sharing options...
slacky Posted December 8, 2013 Share Posted December 8, 2013 (edited) Nope, not doable as far as I know, and I am pretty sure about it. I gotta know... Why you would want to do this? Edited December 8, 2013 by slacky Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 9, 2013 Author Share Posted December 9, 2013 The short answer is...Hmm there is no short answer. In my scripts I use my own custom type to store colors along with all the other associated info (tolerance, cts, cts params). Been doing this for a couple years now. (On a side note I notice SRL-6 has adopted a similar approach now; guess they learned from the best) The problem with this is if you want to define a color as a constant how do you store a mix of integers and floats as a constant. My solution was to store it as a string and write a function to convert the string to the color record. Which works fine if you stick to using numbers. If you use one of SCAR's built in constants (ie clWhite) it breaks down. So for now I have to simply use numbers even when SCAR has a constant to represent that number. Quote Link to comment Share on other sites More sharing options...