From: Tickyy
Hi there!
sahibjs is right, there is a function that already does that
function InFight: Boolean;
That's an SRL5 function and not avaiable on SRL6. I'm not sure the colors/counts are still valid with the updated game.
It uses the health bar above your head which is unreliable. Sometimes that bar stays over your head long after a fight has ended.
I've been using a combination of two ways of detecting the popup box (target info?) that comes up when you start a fight. I use a DTM that matches some of the black boxing on the right hand side and a secondary color method (getting the blackish color to define a box and looking in that box for the white and green colors).
Even this is not fully reliable. When another NPC wanders under your mouse you can get a second popup showing and if you are ranging or using magic your fight may not even be on screen.
I'm looking to add some pixel shift / animation detection. Also looking at the target rings that appear under the NPC you are fighting. Or catching the increase in XP, that's a true indicator the fight is done.
DTM:
'mrAAAAHichcqxCkAAAEXRJyllUharMiCDMjIpm29mNCkmROJL3JSVV2d4dW1JkyltGLHiwI4TF1qaDjMWbDgxoEdaNXJc7+GHkYIkU5wXz4/KWhbNF+PHuxuG4xEk'
Colors:
Popup Blackish color - 2960658 tol 8 hue 6.25 sat 3.35
White NPC name - 15658990 tol 7 hue 4.77 sat 0.44
Green health bar - 3114537 tol 13 hue 0.03 sat 0.31