SRL Archive - Help and Support

FindTalk Error


WhoCares357

2008-03-14 22:43:01

{*******************************************************************************
function FindTalk: Boolean;
by: MastaRaymond and little bit of help from Wizzup?
Description: Searches screen for NickName and handles ALL Talking Randoms.
*******************************************************************************}

Function FindTalk: Boolean;
var
TPA,Matches : TPointArray;
TempATPA : T2DPointArray;
I,CTS,x,y : integer;
Box : TBox;
RawMenuText : String;
begin;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColorsTolerance(TPA, 65535, 3, 3, 515, 336, 0);
if FindTPAinTPA(Players[CurrentPlayer].NickTPA,TPA,Matches) then //Length check inside the function ;)
For I := 0 to High(Matches) do
begin;
FindColorsTolerance(TPA,65535,3, Matches[I].y - 1,516,Matches[I].y + 14,0);
if High(TPA) < 0 then
Continue;
TempATPA := FindGapsTPA(TPA,10);
if Length(TempATPA) > 1 then
begin;
SetLength(TPA,Length(TempATPA));
For x := 0 to High(TempATPA) do
begin;
Box := GetTPABounds(TempATPA[x]);
TPA[x] := Point((Box.x2 + Box.x1) shr 1, Box.y2);
end;
SortTPAFrom(TPA,Point(Matches[I].x,Matches[I].y));
x := TPA[0].x;
y := TPA[0].y;
end else
begin;
Box := GetTPABounds(TempATPA[0]);
x := (Box.x2 + Box.x1) shr 1;
y := Box.y2;
end;
y := y + 8;
MMouse(x, y, 0, 0);
Wait(100 + Random(50));
if IsUpTextMultiCustom(['Talk','lk-to','uard']) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(450 + Random(125));
if ChooseOptiongetMenuText(RawMenuText, x, y, 'Talk') then
begin
WriteLn('******** FOUND TALKING RANDOM TEXT********: ' + RawMenuText);
WriteFileString(TheFile, '******** FOUND TALKING RANDOM TEXT********: ' + RawMenuText +Chr(13))
Talks := Talks + 1;
FFlag(0);
Wait(1337 + Random(500));
SolveTalkingRandom(RawMenuText);
Result := True;
Exit;
end;
end;
end;
ColorToleranceSpeed(CTS);
end;

Why do some begins have a semicolon by them? Is there a reason behind this? I have never seen this done before and was wondering.

Also, I am helping someone with a script through msn and he is having a runtime error :
[Runtime Error] : Out Of Range in line 1229 in script C:\Program Files\SCAR 3.14\includes\SRL/SRL/Core/AntiRandoms/AntiRandoms.scar

His Anti-Randoms procedure:
procedure AntiRandom;

begin
if(NoGameTab)then FindNormalRandoms; // find random events
FindInventoryRandoms;
if FindFight then RunTo('N',True); // if a fight is found, run to the north and run far (will run back automatically)
if FindDead then Exit;
if InBlack then Logout;
FindLamp('strength');

end;

Thanks.

Santa_Clause

2008-03-14 23:03:40

Ray's standards are just funny.

Not sure about the Out Of Range error though.

WhoCares357

2008-03-14 23:07:51

procedure AntiRandom;

begin
if(NoGameTab)then FindNormalRandoms; // find random events
FindInventoryRandoms;
if FindFight then RunTo('N',True); // if a fight is found, run to the north and run far (will run back automatically)
if FindDead then Exit;
if InBlack then Logout;
FindLamp('strength');

end;

That was his Anti-Randoms procedure.

bullzeye95

2008-03-14 23:55:32

And you're sure the NickTPA is set up?

WhoCares357

2008-03-14 23:59:27

Lol. He doesn't actually use the DeclarePlayers procedure. I guess that's the problem. Thanks.