SRL Archive - General Botting Help

Pixel shifting


catsrback321

2014-06-24 14:41:37

Hi everyone,
I was just hoping someone could quickly explain pixel shift for me as the Tutorial is out of date.
I need it to try and detect if I have stopped cutting a tree.
Thanks for reading.

edit:
This is pretty much what I've got so far

function AmIMoving:boolean;
var
Shuffle:integer;
PSB:Tbox
begin
PSB:=IntToBox(260, 140, 310, 225);
begin
Shuffle:= (getPixelShift(PSB, 2000));
if Shuffle>(1000) then
writeln('we are moving');
end;
end

The Mayor

2014-06-24 18:21:09

From: catsrback321
Hi everyone,
I was just hoping someone could quickly explain pixel shift for me as the Tutorial is out of date.
I need it to try and detect if I have stopped cutting a tree.
Thanks for reading.

edit:
This is pretty much what I've got so far


When working with pixel shift it is best to draw the box on SMART and use writeLns to debug it. Just play around with it until you get the best results (i.e. the box size can depend on zoom level).

Run this, login manually, press play, and then chop trees manually and see how accurate the debug output is:


program pixelShift;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}

function amIMoving(): boolean;
var
PSB: Tbox
begin
PSB := intToBox(260, 140, 310, 225);
smartImage.drawBox(PSB, false, clRed);

result := getPixelShift(PSB, 500) > 400;

if result then
writeln('We are moving')
else
writeln('We are not moving');
end;

begin
smartEnableDrawing := true;
setupSRL();

repeat
amIMoving();
until false;

end.

Flight

2014-06-24 20:51:53

It's not out of date, the tutorial still applies to working with any PascalScript version include, it just doesn't work with SRL-6.

catsrback321

2014-06-25 14:35:55

Thanks mayor :) got pixel shift working now, rest of the script is so nasty it hurts though, going to look through suggestions and try to find an easier idea.