Janilabo

Untitled

Mar 31st, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.34 KB | None | 0 0
  1. var
  2.   bmpEmpty, bmpFull: TSCARBitmap;
  3.                              
  4. procedure ScriptTerminate;
  5. begin
  6.   bmpEmpty.Free;
  7.   bmpFull.Free;
  8. end;
  9.  
  10. function ValueToPercent(position, source: Extended): Extended;
  11. begin
  12.   if (position <> 0) then
  13.     Result := ((position / source) * 100);
  14. end;
  15.  
  16. function GetHPPercent: Extended;
  17. var
  18.   c, m: Integer;
  19.   area: TBox;
  20. begin
  21.   area := GetClient.ImageArea;  
  22.   c := CountBitmap(bmpFull, area.X1, area.Y1, area.X2, area.Y2);
  23.   m := (c + CountBitmap(bmpEmpty, area.X1, area.Y1, area.X2, area.Y2));
  24.   Result := ValueToPercent(c, m);
  25. end;
  26.  
  27. function GetMaxHP: Integer;
  28. var
  29.   area: TBox;
  30. begin
  31.   area := GetClient.ImageArea;
  32.   Result := (CountBitmap(bmpEmpty, area.X1, area.Y1, area.X2, area.Y2) and CountBitmap(bmpFull, area.X1, area.Y1, area.X2, area.Y2));
  33. end;
  34.  
  35. function GetHP: Integer;
  36. var
  37.   area: TBox;
  38. begin
  39.   area := GetClient.ImageArea;
  40.   Result := CountBitmap(bmpFull, area.X1, area.Y1, area.X2, area.Y2);
  41. end;
  42.  
  43. begin
  44.   GetClient.Activate;
  45.   bmpFull := TSCARBitmap.Create('deNrjZeBm+A8EDg4EEASMKhtoZQDQDvbe');
  46.   bmpEmpty := TSCARBitmap.Create('deNrjZeBm+P//vwMh8B8MRpUNuDIAn7Kclw==');
  47.   Wait(500);                                              
  48.   WriteLn('HP: ' + IntToStr(GetHP) + '/' + IntToStr(GetMaxHP));
  49.   WriteLn('HP Percent: ' + FloatToStr(GetHPPercent) + '%');
  50. end.
Advertisement
Add Comment
Please, Sign In to add comment