Jump to content
Macro Express Forums

Peter1

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Peter1

  1. 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.

×
×
  • Create New...