SRL Archive - OSR Help

script doesent go to the next part


rj

2011-10-17 18:01:01

//auto theiver by thehatered(rjj95)
program Autotheiver;
Procedure LootCakes;
Var
X,Y,I: Integer;
begin
wait(800);
if FindColorTolerance(X,Y,5231294,185,134,208,173,12) then
begin
wait(500);
movemouse(x, y);
wait(500);
for i := 0 to High(9) do //This means repeat the code below 9 times
begin
ClickMouse(x, y, Mouse_Left);
wait(1700);
end;
//Now that we've done that 9 times, let's continue the script
wait(3000);
end else
writeln('Failed to find color (table color)');
end;
Procedure SellCakes;
Var
X,Y: Integer;
begin
//find NPC
wait(1000);
if FindColorTolerance(x,y,3689566,166,195,194,213,12) then
begin
wait(500);
ClickMouse(x, y, Mouse_Left);
wait(1200);
end else
writeln('Failed to find color (find NPC)');
//find cake
if FindColorTolerance(x,y,207164,607,211,635,240,12) then
begin
wait(500);
ClickMouse(x, y, Mouse_Left);
wait(1200);
end else
writeln('Failed to find color (find cake)');
//sell cake
if FindColorTolerance(x,y,2070783,550,295,608,311,50) then
begin
wait(500);
ClickMouse(x, y, Mouse_Left);
wait(1200);
end else
writeln('Failed to find color (sell cake)');

//close out
if FindColorTolerance(x,y,3358280,419,24,501,52,50) then
begin
wait(500);
ClickMouse(x, y, Mouse_Left);
wait(1200);
end else
writeln('Failed to find color (close out)');
//find square
if FindColorTolerance(x,y,942420,288,115,321,151,50) then
begin
wait(500);
ClickMouse(x, y, Mouse_Left);
wait(1200);
end else
writeln('Failed to find color (find square)');
end;
begin
LootCakes;
SellCakes;
end.
my script only does the first part were it it suposed to loop 9 times then continue but instead of just loops for ever until i stop the script. btw thanks to flight for cleaning up my original script to make it working

masterBB

2011-10-17 19:42:33

for i := 0 to High(9) do

should be

for i := 0 to 9 do

High is only used on arrays(sort of lists). That would return the highest number out of the array, but since 9 is an integer, you should just use 9.

Flight

2011-10-17 20:56:57

From: masterBB
for i := 0 to High(9) do

should be

for i := 0 to 9 do

High is only used on arrays(sort of lists). That would return the highest number out of the array, but since 9 is an integer, you should just use 9.


:duh: I've never used a static integer for such a loop, so I've always used High() + a given array. I feel dumb. :(