Jump to content


Photo

LoadRGB giving same values on different pictures

LoadRGB color problem pixel background same value

  • Please log in to reply
2 replies to this topic

#1 Nironior

Nironior

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 12 April 2019 - 05:02 AM

Hey, I've been having a weird problem with LoadRGB. I'm making a script for Gems of war (a match-3 game) which keeps matching gems until one of my four spells is ready and then casts one of the spells. The script is able to detect when a spell is ready because a picture changes entirely when it is ready to cast, so i constantly check the values with LoadRGB and override the normal script when the picture changes. 

Here's the weird thing, It works perfectly for two of the four spells, namely the top two in the screen. But the last two spells, even though the pictures change completely, keep outputting the exact same color values on every pixel (i've tried it on more than hundred pixels, all yield the same values).

 

Here's a screenshot of the game to clarify my problem:
JMzIlVd.jpg

 

The second picture which is circled in green does yield different values when the picture changes.

The last one (which is circled red) does not output different values as you can see in my Notepad, even though those pictures are different.

Does anyone have an idea how this is possible?
My only theory is that for the last spell, LoadRGB somehow values the background instead of the picture itself.

But that would be strange for several reasons, most of all that it does not do that for the spell/picture which is circled in green.



#2 Nironior

Nironior

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 12 April 2019 - 05:43 AM

After some more testing I found out that I was lucky with getting values on the first two spells.

It seems that on each picture there is only a small range in which LoadRGB actually reads the values of the picture itself and not the background.

These are the values on ten adjacent pixels i got when testing the values on the second spell again:

29 and 114 and 255 op 228 362        29 and 114 and 255 op 228 362        Same
29 and 114 and 255 op 227 362        29 and 114 and 255 op 227 362        Same
29 and 114 and 255 op 226 362        29 and 114 and 255 op 226 362        Same
29 and 114 and 255 op 225 362        29 and 114 and 255 op 225 362        ,,
29 and 114 and 255 op 224 362        29 and 114 and 255 op 224 362        ,,
29 and 114 and 255 op 223 362        29 and 114 and 255 op 223 362        ,,
29 and 114 and 255 op 222 362        28 and 110 and 247 op 222 362        Different
29 and 114 and 255 op 221 362        25 and 97 and 215 op 221 362          Different
29 and 114 and 255 op 220 362        6 and 23 and 52 op 220 362              Different
29 and 114 and 255 op 219 362        4 and 8 and 28 op 219 362                Different
 
Do you guys think that my theory is correct?
("It seems that on each picture there is only a small range in which LoadRGB actually reads the values of the picture itself and not the background.")


#3 Ego

Ego

    Insane Poster

  • Moderators
  • 431 posts
  • LocationAustralia

Posted 12 April 2019 - 05:49 AM

With no code I would only be guessing.

So one way I can think of is make objects, a bit slower in reading the colours, but more control over what it is looking for.

Ego is not a dirty word