Ashaman88
2012-11-18 19:39:16
Will be putting some functions I'll be using with EOC. I'll edit this post with them as I do them
Gets the players max hp level:
Did this because your max hp no longer set upon your hp level, but also armors and such. So what it does is it goes to the combat tab, moves the mouse over your health icon, then a black box pops up with the % of health you have. It gets that black box and searches for the text in it, converts it to a number. Then it calculates what your total hp should be based on that % and what your current hp lvl is at. Borrowed parts from getchooseoptions
Gets the players max hp level:
Function HPLevel: Integer;
Var
ColourString: String;
Begin
Result:= GetMMLevels('HP', ColourString);
End;
Function GetMaxHP: Extended;
Var
Text: String;
B, BigBox: TBox;
TPA : TPointArray;
ATPA : T2DPointArray;
I,cts: Integer;
BoxColors: TIntegerArray;
Begin
GameTab(Tab_Combat);
HumanMouseBox(650,394-50,682,401-50);
Wait(RandomRange(500,700));
B := IntToBox(594, 365-50, 694, 394-50);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
// Black
BoxColors := [1774603];
SetLength(ATPA, Length(BoxColors));
for i := 0 to High(BoxColors) do
FindColorsTolerance(ATPA[i], BoxColors[i], B.X1, B.Y1, B.X2, B.Y2, 0);
TPA := MergeATPA(ATPA);
If Length(TPA) < 10 Then
begin
Writeln('Not enough colors');
ColorToleranceSpeed(cts);
Exit;
end;
ATPA := SplitTPA(TPA, 4);
For i := 0 to High(ATPA) do
begin
B := GetTPABounds(ATPA[i]);
if ((B.x2-B.x1) > 4) and ((B.y2-B.y1) > 4) then
Break
else
B := IntToBox(0, 0, 0, 0);
end;
If (B.x2 = 0) then
begin
ColorToleranceSpeed(cts);
Exit;
end;
BigBox := B;
Text:= GetTextAtExWrap(BigBox.X1, BigBox.Y1, BigBox.X2, BigBox.Y2, 0, 5, 2, 3111603, 10, 'UpChars');
Text:= Copy(Text, 0, High(Text)-1);
If (StrToIntDef(Text, 0)=100) Then
Result:=HPLevel Else
Result:= (HPLevel*100)/(StrToIntDef(Text, 0));
End; Did this because your max hp no longer set upon your hp level, but also armors and such. So what it does is it goes to the combat tab, moves the mouse over your health icon, then a black box pops up with the % of health you have. It gets that black box and searches for the text in it, converts it to a number. Then it calculates what your total hp should be based on that % and what your current hp lvl is at. Borrowed parts from getchooseoptions