1
Answer

Trigger actions to pixel color change

Jose Atiles

Jose Atiles

16y
3.2k
1
Hi there!  I've been trying put audio into an old silent game I have.  The game is free but not open source and the author hasn't made any update since 2007. Putting audio would be as simple as downloading winamp, what I actually am interested is that such audio switches when a battle occurs.  I figured a way to do it, in a very simple manner: the character is red and is always in a fixed position of the screen; the same position of the battle screen is blue.  So, basically with a macro program i was able to work around this to some extent, but now that i know a bit more about coding i'd like to make it using C#, which will give me more freedom.

I'd like to know the following:

How to read pixel color of an X,Y coordinate ANYWHERE on the screen, not just the form; although the X,Y of whatever is on focus will work, since the game will probably be on focus...

How to trigger an action (any action will do like a message box, although i'll insert later the audio playing code) whenever the pixel color of A,B coordinate changes...with the macro utility i used while and nested if s but if theres something better i'd like to hear any suggestion on the matter.

That's about it for now thanks in advance!
Answers (1)