Results 1 to 4 of 4

Thread: Pixel shifting

  1. #1
    Join Date
    May 2012
    Posts
    126
    Mentioned
    1 Post(s)
    Quoted
    57 Post(s)

    Default Pixel shifting

    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

    Simba Code:
    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

  2. #2
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by catsrback321 View Post
    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:

    Simba Code:
    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.

  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    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.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  4. #4
    Join Date
    May 2012
    Posts
    126
    Mentioned
    1 Post(s)
    Quoted
    57 Post(s)

    Default

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •