Reveille
01-14-2012, 03:34 AM
I'm gradually learning how to script, I've read most of the tutorials in the beginner and a few in the intermediate. I'm also reading scripts as reference. I just finished reading PatDuffy's Firemaking script "Burning Down da House". I understand most of the script but can someone explain to me a few lines? I included the entire procedure but the only part I don't understand is the if (TPA[I].y)=(TPA[I+1].y) then part in the alternative method.
Procedure tobank;
Var
TPA:TPointArray;
ATPA:T2DPointArray;
L,S,I:Integer;
Begin
GetNewRoadColor(mmx1,mmy1,mmx2,mmy2,6);
repeat
findnormalrandoms;
RadialRoadWalk(RoadColor,80,110,70,-2,0);
writeln('Walking to bank. The roadcolor is:'+inttostr(roadcolor)+'.');
if kill=3 then
begin
writeln('Walking to bank failed, logging out...');
logout;
TerminateScript;
end;
inc(kill);
writeln(countdots('yellow'));
until findsymbol(x,y,'bank') Or (CountDots('yellow') > 10)
//bank
kill:=0;
wait(RandomRange(1000,1000));
writeln(countdots('yellow'));
if findsymbol(x,y,'bank') then
writeln('using bank symbol')else
begin
writeln('using alternate method');
TPA:=GetMinimapDotsIn('yellow', MMX1, MMY1, MMX2, MMY2);
L:=length(TPA);
S:=0;
I:=0;
repeat
inc(I);
if (TPA[I].y)=(TPA[I+1].y) then
if (TPA[I].y)=(TPA[I+2].y) then
S:=I;
until S>0
writeln(S)
writeln(TPA);
x:=TPA[S].x
y:=TPA[S].y
end;
mouse(x,y,7,7,true);
wait(RandomRange(8000,9000));
End;
Procedure tobank;
Var
TPA:TPointArray;
ATPA:T2DPointArray;
L,S,I:Integer;
Begin
GetNewRoadColor(mmx1,mmy1,mmx2,mmy2,6);
repeat
findnormalrandoms;
RadialRoadWalk(RoadColor,80,110,70,-2,0);
writeln('Walking to bank. The roadcolor is:'+inttostr(roadcolor)+'.');
if kill=3 then
begin
writeln('Walking to bank failed, logging out...');
logout;
TerminateScript;
end;
inc(kill);
writeln(countdots('yellow'));
until findsymbol(x,y,'bank') Or (CountDots('yellow') > 10)
//bank
kill:=0;
wait(RandomRange(1000,1000));
writeln(countdots('yellow'));
if findsymbol(x,y,'bank') then
writeln('using bank symbol')else
begin
writeln('using alternate method');
TPA:=GetMinimapDotsIn('yellow', MMX1, MMY1, MMX2, MMY2);
L:=length(TPA);
S:=0;
I:=0;
repeat
inc(I);
if (TPA[I].y)=(TPA[I+1].y) then
if (TPA[I].y)=(TPA[I+2].y) then
S:=I;
until S>0
writeln(S)
writeln(TPA);
x:=TPA[S].x
y:=TPA[S].y
end;
mouse(x,y,7,7,true);
wait(RandomRange(8000,9000));
End;