Peter1 Posted January 6, 2008 Report Share Posted January 6, 2008 I'm wanting to detect whether a bar is full or not. Just using get pixel won't work because the bar has a gradient shading, color changes with angle, and its semi transparent. So is the shade is more or less constantly changing. I guess this means I'll have to detect a range of shades. Ive looked around on the forum and found a fellow who was wanting to do the exact same thing I am. Kevin did reply with a proposed soultion but the poster never replied back to say whether it worked. His soultion was to get interger returned by get pixel into RGB values. // Get pixel color Get Pixel: Under Mouse into %N10% Variable Modify Integer: Copy %N10% to %N1% Variable Modify Integer: Convert %N1% to decimal %D1% // Get Red value Variable Modify Decimal: %D1% = %D1% / 256 Variable Modify Decimal: Copy fraction part of %D1% to %D11% Variable Modify Decimal: %D11% = %D11% * 256 // Get Green value Variable Modify Decimal: Truncate %D1% to integer %N1% Variable Modify Integer: Convert %N1% to decimal %D1% Variable Modify Decimal: %D1% = %D1% / 256 Variable Modify Decimal: Copy fraction part of %D1% to %D12% Variable Modify Decimal: %D12% = %D12% * 256 // Get Blue value Variable Modify Decimal: Truncate %D1% to integer %N1% Variable Modify Integer: Convert %N1% to decimal %D13% // Here: // D11 = Red // D12 = Green // D13 = Blue Text Box Display: Result http://pgmacros.invisionzone.com/index.php?showtopic=1280&hl=colors The thing that I'm not getting is the "Variable Modify Decimal: Copy fraction part " commands. I don't see the copy fraction part under Variable Modify Decimal. I tried just doing a regular copy but the results for red and green returned more digits then 3. So this leads me to believe the copy fraction part is hiding frome me, or perhaps this command has changed to some other place/no longer exists in macro express since the thread is well over a year old. Quote Link to comment Share on other sites More sharing options...
kevin Posted January 6, 2008 Report Share Posted January 6, 2008 When you select the 'Remove Integer' option in the Variable Modify Decimal command dialog it puts Variable Modify Decimal: Copy fraction part of %D1% to %D1% in the Scripting Editor. Quote Link to comment Share on other sites More sharing options...
Peter1 Posted January 6, 2008 Author Report Share Posted January 6, 2008 Thank you! Now that RGB is working I'm pretty sure I can finish it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.