JPHamlett
2009-09-26 22:33:51
function GetMMLevels(LevelType: string; ColorSign: string): Integer;
var
Colors : TIntegerArray;
Signs: TStringArray;
P: TPointArray;
TP: TPoint;
I: Integer;
B: TBox;
T, x, y: Integer;
Run: Boolean;
begin;
Result := -1;
ColorSign := '';
case LowerCase(Leveltype) of
'health', 'hp', 'hitpoints': TP := Point(729,29);
'prayer', 'pray' : TP := Point(746,68);
'run','energy' :
begin
TP := Point(740,107);
Run := True;
end;
else
begin;
srl_Warn('GetMMLevels', 'Invalid LevelType: ''' + LevelType + '', warn_AllVersions);
Exit;
end;
end;
Colors := [65280, 65535, 2070783, 255];
Signs := ['Green', 'Yellow', 'Orange', 'Red'];
for I := 0 to 3 do
begin
if Run then
begin
MarkTime(T);
repeat
begin
if not IsResting then Break;
if not FindColorComp(x, y, clYellow, ccBlue, 737, 107, 742, 108, 130) then Break;
end;
until (TimeFromMark(T) >= 5000);
end;
FindColorsTolerance(P, Colors[i], TP.X - 5, TP.Y - 5, TP.X + 40, TP.Y + 20, 30);
if (Length(P) < 1) then continue;
B := GetTPABounds(P);
Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1 , B.Y1 - 1, 30, statChars,
False, False, 0, 0, Colors[i], 20, False, tr_Digits)), -1);
if (Result > 0) then
begin
ColorSign := Signs[i];
Exit;
end;
end;
end;
i keeped getting an error
[Error] (20842:24): Variable Expected in script
and i fixed it all i did was change
GetMMLevels(LevelType: string; var ColorSign: string);
to
GetMMLevels(LevelType: string; ColorSign: string)