SRL Archive - OSR Help

Ffs why is this not returning


rj

2013-05-22 22:40:40

Ok, so I am trying to make a function to check to see if colors changed:

{$i srl/srl.simba}
Var
s_Points:TPointArray;
function pointsChanged(pnts:TPointArray): Integer;
Var
c, i, t, matched:Integer;
begin
MarkTime(t);
repeat
for i:=0 to high(pnts) do
begin
c := GetColor(pnts[i].x,pnts[i].y);
if (c = (GetColor(pnts[i].x,pnts[i].y))) then matched:=matched+1;
end;
try
result := Round((matched)/(high(pnts)*100));
exit;
except
writeln('Error calculating');
exit;
end;
until (TimeFromMark(t)>500)
end;

begin
s_Points := [Point(0,0),Point(1,1)];
repeat
wait(100)
until(pointsChanged(s_Points)>10)
end.


But it does not work for some reason, I tested it on paint what the hell am I doing wrong?

Flight

2013-05-23 00:10:47

If I'm understanding you right you're wanting to calculate how many points, from the given point array, change after X milliseconds? If so use this I made for an anti-random:

function getPixelShiftTPA(T: Integer; TPA: TPointArray): Integer;
Var
BMP,BMP2: Integer;
begin
BMP := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);
Wait(T);
BMP2 := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);

Result := CalculatePixelShiftTPA(BMP, BMP2, TPA);
FreeBitmap(BMP);
FreeBitmap(BMP2);
end;

The parameters speak for themselves, T = time between checking the TPA, and TPA is the TPA (only the TPA) that will be checked for pixelshift.

An example would be

if (getPixelShiftTPA(500, FishingSpotTPA) > 50) then
Writeln('This TPA shifted 50 pixels in 500ms, it must be a spot!');

rj

2013-05-23 08:33:40

From: Flight
If I'm understanding you right you're wanting to calculate how many points, from the given point array, change after X milliseconds? If so use this I made for an anti-random:

function getPixelShiftTPA(T: Integer; TPA: TPointArray): Integer;
Var
BMP,BMP2: Integer;
begin
BMP := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);
Wait(T);
BMP2 := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);

Result := CalculatePixelShiftTPA(BMP, BMP2, TPA);
FreeBitmap(BMP);
FreeBitmap(BMP2);
end;

The parameters speak for themselves, T = time between checking the TPA, and TPA is the TPA (only the TPA) that will be checked for pixelshift.

An example would be

if (getPixelShiftTPA(500, FishingSpotTPA) > 50) then
Writeln('This TPA shifted 50 pixels in 500ms, it must be a spot!');

O thanks thanks!