One problem with using the text to check if the monster is in a fight is that if you're just attacking stuff the text won't be scrolling very fast. It will probably stay as 'already fighting' for quite a while, making your script think every monster is in combat.
I would suggest you use my chickenkiller as a reference. I use sequential searches for colors. So, if a monk has a brown robe and a white head, then you could search for the headcolor, then the brown robe color, then another slightly different brown robe color. The benefit of doing it this way is that you can do all your monsterfinding before you ever move the mouse. So, if you work it out and use good colors, you will only need to make one mouse move over to the monster and click it to attack. FindObj only uses one color and moves the mouse all over the screen to find the monster name in the uptext, which I think is annoying and probably detectable.
Once you've located a monster with the color searches, you should then see if it is already in combat. Again, you can do this before you move the mouse by searching for the green color or the red color of the health bar in a small square around the monk location you found with your color search.
There is an AttackMonster function in SRL/SRL/skill/fighting.scar. You could also look at that as an example. One problem with that function is that it doesn't check for being in combat.
If you copy that function into your own script you can modify it to check for combat by adding something like this after getting the coordinates from the color search part of the function...
Code:
if not(FindColor(tmpx2,tmpy2,65280,x-10,y-10,x+10,y+10)) then
if not(FindColor(tmpx2,tmpy2,255,x-10,y-10,x+10,y+10)) then
begin
MMouse(x,y,1,2);
Wait(50);
if IsUpText(MonsterName) then
begin
Mouse(x,y,1,2,true);
Result:=True;
Monsterkills:=Monsterkills+1;
Players[CurrentPlayer].Killed := Players[CurrentPlayer].Killed + 1;
exit;
end;
end;
...where x and y are the location of the monster.
65280 is the green color in the health bar. 255 is the red color in the health bar.
If you do not include the fighting.scar include then you do not need to change the name of the AttackMonster function in your own script. If you do, then you will need to rename it, like AttackMonsterProf.
Good luck!