For the combat detection, I use a DTM of the weakness symbol (varies depending on NPC though - you might be better with the gold lock);
Simba Code:
function isInCombat() : boolean;
var
x, y : integer;
begin
result := findDTM(weaknessDTM, x, y, intToBox(mainScreen.x1, mainscreen.y1, minimap.x2, actionBar.y2));
end;
Your object finder doesn't do what you think it does. You are still passing a string (bounds) into the findColorsSpiralTolerance function. You'd be better off passing in a TBox as a function parameter and using that directly.
function ObjectFinder(bounds: TBox; col, tol ...
findColorsSpiralTolerance(x, y, TPA, col, bounds,