Hi guys,
A little contribution (it's not perfect..)
Simba Code:
program HealthTest;
{$Define SMART8}
{$include SRL/SRL.simba}
{$include SPS/SPS.simba}
{$include SRL/SRL/Misc/SmartGraphics.simba}
var
DebugBitmap: integer;
const
debug = true;
function FindGreenHealth: integer;
var
HealthBarTPA: TPointArray;
HealthBarATPA: T2DPointArray;
begin
if (Findcolors(HealthBarTPA, 65280, MSX1, MSY1, MSX2, MSY2)) then
begin
SplitTPAWrap(HealthBarTPA, 10, HealthBarATPA);
SortATPAFromMidPoint(HealthBarATPA, Point(251, 171));
if (debug) then
Smart_DrawDotsEx(true, HealthBarTPA, clBlue);
result := High(HealthBarATPA[0]);
end;
end;
function CalculateHealth: integer;
var
Conversion, Red, Green: extended;
Calculation: integer;
begin
Green := FindGreenHealth;
Conversion := (green / 149) * 100;
Calculation := Round(Conversion);
if (Calculation < 1) then
begin
result := - 1;
end
else
result := Calculation;
end;
begin
SetupSRL;
Smart_SetupDebug;
repeat
Cleardebug;
writeln(CalculateHealth);
Wait(3000);
until (false)
end.
What it does:
Green is a constant color in old rs, so it checks for that color on the screen using FindColors().
It then splits all the TPA's into ATPA's and check for the first ATPA in the middle (characters health bar)
It then (if debug = true -> debugs on smart) calculates the health in % using very simple math.