SRL Archive - SRL Archives

simple fix in gametab


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)

Method

2009-09-26 22:50:36

That's not a fix - the function is designed so you pass a variable to it. ColorSign will contain the color that was found, if one was found at all.

Naum

2009-09-26 23:04:06

J_Pizzle, There is a clear and valid reason for it to be that way.

You cant just put 'red' in there, you must assign it to a variable hence the : var

For example:

function RunEnergy(Min: Integer): Boolean;
var
T: String;
begin
Result := (GetMMLevels('run', t) >= Min);
if (Result) then SetRun(True);
end;


JPHamlett

2009-09-26 23:18:43

oh srry guys i ddint understnd that i though it was a typo on the devs part sorry

EvilChicken!

2009-10-02 16:47:49

Closed.