Page 4 of 5 FirstFirst ... 2345 LastLast
Results 76 to 100 of 112

Thread: Devs Need Random Accounts

  1. #76
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Overtime View Post
    @NCDS i cleaned them all up, and set them all at draynor, so none have randoms AFIK.

    If i was home i would do a suicide run and collect some randoms.

    For the most part they have been working fine, except the balloon one ofc.
    Alright, no problem. I was busy with other things lately but my time is clearing up somewhat so if you get some randoms and feel like donating again please feel free.

  2. #77
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Does this go in randoms bugs?: if i have reflection antirandoms and use random tool, my scripts seem to log me out asap im in a random.

  3. #78
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by KingKong View Post
    Does this go in randoms bugs?: if i have reflection antirandoms and use random tool, my scripts seem to log me out asap im in a random.
    This thread is for SRL's solvers, nothing to do with Reflection.

  4. #79
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    ***** STR: FOUND RANDOM: 'Surprise Exam' *****
    Screenshot of: Found Surprise Exam random 50 Seconds
    ***** STR: 'Surprise Exam' RANDOM SOLVING FAILED! *****

    tested it with both color randoms and reflection randoms. i have my account in it if you guys need it.

    EDIT: after a few days, and no reply, i got out of the random so i could continue botting
    Last edited by x[Warrior]x3500; 06-11-2011 at 11:11 PM.

  5. #80
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I forgot to comment a while ago, there was a problem with the grog princess random. If you logged in and were already talking to the frog (I restarted the script to watch if a second attempt would solve it) then it would try and find the princess and kiss her immediately. However the herald frog or whatever would say that you hadn't finished talking ( a simple 'ClickToContinue' thing) and he wouldn't let you kiss the princess and get out.

    Basically
    Log in while talking to herald

    see's its talking with herald, runs off to find princess thinking herald part is done

    herald says you cant talk to the princess as you haven't been told what to do.

    Repeat the last to steps ad infinitum.

    I don't know if this was a one off as something went wrong as i haven't had the frogs random since then.
    The truth finally came out...


  6. #81
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    So, because noone pmd me details of acc in pp random i decided to post it without "in random tests" It is only tested on the bmps which i have.

    Code was made in delphi, lazarus wasn't working for me :/ and it is compatible with scar. Anyone who want to work on this code, feel free to do it.

    With love for You, Iroki


    Code:
    library PrisonPete_scar;
    
    
    uses
      SysUtils,
      Classes,
      Windows,
      Math,
      Graphics;
    
    {$R *.res}
    
    type
      TSCARPlugFunc = record
        Name: ansistring;
        Ptr: Pointer;
      end;
    
      TOneStrProc = procedure(s: ansistring);
      TSCARWindowHandle = function(): Integer;
    
    type
      TRGB32 = packed record
        B, G, R, A: Byte;
      end;
      TRGB32Array = packed array[0..MaxInt div SizeOf(TRGB32) - 1] of TRGB32;
      PRGB32Array = ^TRGB32Array;
    
      TPointArray = array of TPoint;
    
    
    var
      Writeln: TOneStrProc;
      GetClientWindowHandle: TSCARWindowHandle;
      FillInfo: Boolean;
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       Prison Pete
       By: Iroki
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    type
      AnimalCorner = record
        x1, y1, x2, y2: integer;
    end;
    
    
    function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean;  stdcall;
    var
      BMP: TBitmap;
      Line: PRGB32Array;
      x, y, w, h: Integer;
    
      c: array of array of Integer;
    
      Found1: Boolean;
      AnimalCorners: AnimalCorner;
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this procedure.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    procedure ColorAreaInsideBox(x1, y1, x2, y2: integer; Color1, Color2: TColor);
    var
      i, j: integer;
    begin
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color1) then c[i][j] := Color2;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts amount of pixels which are
      used to create animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountAreaInsideBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    var
      i, j, Area: integer;
    
    begin
      Area := 0;
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then Area := Area + 1;
    
      Result := Area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts colored area inside "animal".
    
      Thanks to Nava2 for the little help :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountColoredAreaInsideAnimal(x1, y1, x2, y2: integer; Color: TColor): integer;
    const
       ax : array[0..7] of ShortInt = (1, 0,-1, 0, 1, 1,-1,-1);
       ay : array[0..7] of ShortInt = (0, 1, 0,-1,-1, 1, 1,-1);
    
    var
      i, j, k, area: integer;
      tmp_bool: boolean;
    
    begin
      Area := 0;
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then
          begin
    
            tmp_bool := True;
    
            for k := 0 to 7 do
              if (c[i + ax[k]][j + ay[k]] <> Color) then
              begin
                tmp_bool := False;
                break;
              end;
    
            if tmp_bool then area := area + 1;
    
          end;
    
      Result := area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function counts pixels used to create outline of animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountOutlineInBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    begin
    
      Result := (CountAreaInsideBox(x1, y1, x2, y2, Color) -
                 CountColoredAreaInsideAnimal(x1, y1, x2, y2, Color));
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      That lines of code was orginally created by Sky Scripter and were named "ScanFill".
      I have rewrited it completely, and now it SHOULD work properly. This procedure should
      theoreticaly find coordinates of "box" in which the baloon animal is.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    procedure FloodFillAndFindAnimalBoxCoords(x, y: integer; Color1, Color2: TColor);
    const
       xx : array[0..3] of ShortInt = (1, -1, 0, 0);
       yy : array[0..3] of ShortInt = (0, 0, 1, -1);
    
    var
      i: integer;
    
    begin
    
      if ((c[x][y] = Color1) and (x > 4) and (x < w - 4) and (y > 4) and (y < h - 4)) then
      begin
        c[x][y] := Color2;
    
        if (AnimalCorners.x1 > x) then AnimalCorners.x1 := x;
        if (AnimalCorners.x2 < x) then AnimalCorners.x2 := x;
        if (AnimalCorners.y1 > y) then AnimalCorners.y1 := y;
        if (AnimalCorners.y2 < y) then AnimalCorners.y2 := y;
    
        for i := 0 to 3 do
          FloodFillAndFindAnimalBoxCoords(x + xx[i], y + yy[i], Color1, Color2);
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this function.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindGoat(Color: TColor): boolean;
    var
      Outline, Area: integer;
    
    begin
      Result := False;
    
      Area := CountAreaInsideBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);
      Outline := CountOutlineInBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);
    
      if (InRange(Area,220, 320) and InRange(Outline, 105, 200)) then
      begin
        px := AnimalCorners.x1 + Round((AnimalCorners.x2 - AnimalCorners.x1)/2);
        py := AnimalCorners.y1 + Round((AnimalCorners.y2 - AnimalCorners.y1)/2);
    
        Result := True;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Same as above.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindCat(x1, y1, x2, y2: integer; Color: TColor): Boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsLongTail: boolean;
    
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsLongTail := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
    
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    
    
      if (how = 2) then
      begin
        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindDog(x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y,how, value,lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsDog1, IsDog2: boolean;
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsDog1 := False;
      IsDog2 := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
      if (how = 2) then
      begin
    
        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ^^
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindSheep(var x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue,
      ones, twoes: integer;
      IsBigBody: boolean;
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsBigBody := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
    
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((y2 - y1) < 27) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    
      if (how = 2) then
      begin
        for y := y1 to y2 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
               begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((x2 - x1) < 27)then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Main loop (ground detecting)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    begin
      w := 516; h := 338;
      Bmp := TBitmap.Create;
      Bmp.Width := w;
      Bmp.Height:= h;
      Bmp.PixelFormat := pf32bit;
      SetLength(c, w + 1, h + 1);
      BitBlt(Bmp.Canvas.Handle, 0, 0, w, h, ClientHDC, 0, 0, SRCCOPY);
      Result := False;
    
      //finding animals and coloring red
      for y := 4 to h - 4 do
      begin
        Line := bmp.ScanLine[y];
        for x := 4 to w - 4 do
        begin
          c[x][y] := RGB(Line[x].R, Line[x].G, Line[x].B);
          if ((Line[x].G <> 0) and (Line[x].R > 150) and (Line[x].G < 120) and (Line[x].B > 120)) then
            c[x][y] := clred else c[x][y] := 0;
        end;
      end;
    
    
      Found1 := False;
      for y := 4 to h - 4 do
        for x := 4 to w - 4 do
        if (c[x][y] = clred) then
        begin
          if not Found1 then
          begin
          
            AnimalCorners.x1 := w - 4;
            AnimalCorners.x2 := 4;
            AnimalCorners.y1 := h - 4;
            AnimalCorners.y2 := 4;
    
            FloodFillAndFindAnimalBoxCoords(x, y, clred, clyellow);
    
            case AnimalId of
              1: if FindGoat(clyellow) then Found1 := True;
              2: if FindSheep(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              3: if FindCat(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              4: if FindDog(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
            end;
    
          end;
    
        end;
    
      Bmp.Free;
      if Found1 then Result := True;
    end;
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       End of Prison Pete solver.
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    function GetFunctionCount(): Integer; stdcall; export;
    begin
      Result := 1;
    end;
    
    
    function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PAnsiChar): Integer; stdcall;
    begin
      case x of
        0:
          begin
            ProcAddr := @Pete_FindAnimal2;
            StrPCopy(ProcDef, 'function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean;');
          end;
    
      else
        x := -1;
      end;
      Result := x;
    end;
    
    
    procedure SetFunctions(Funcs: array of TSCARPlugFunc); stdcall;
    var
      i: Integer;
    begin
      for i := 0 to Length(Funcs) - 1 do
      begin
        if Funcs[i].Name = 'Writeln' then
          Writeln := Funcs[i].Ptr;
        if Funcs[i].Name = 'GetClientWindowHandle' then
          GetClientWindowHandle := Funcs[i].Ptr;
      end;
      FillInfo := false;
    end;
    
    exports GetFunctionCount;
    exports GetFunctionInfo;
    exports SetFunctions;
    
    end.
    :P

  7. #82
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Iroki View Post
    So, because noone pmd me details of acc in pp random i decided to post it without "in random tests" It is only tested on the bmps which i have.

    Code was made in delphi, lazarus wasn't working for me :/ and it is compatible with scar. Anyone who want to work on this code, feel free to do it.

    With love for You, Iroki


    Code:
    library PrisonPete_scar;
    
    
    uses
      SysUtils,
      Classes,
      Windows,
      Math,
      Graphics;
    
    {$R *.res}
    
    type
      TSCARPlugFunc = record
        Name: ansistring;
        Ptr: Pointer;
      end;
    
      TOneStrProc = procedure(s: ansistring);
      TSCARWindowHandle = function(): Integer;
    
    type
      TRGB32 = packed record
        B, G, R, A: Byte;
      end;
      TRGB32Array = packed array[0..MaxInt div SizeOf(TRGB32) - 1] of TRGB32;
      PRGB32Array = ^TRGB32Array;
    
      TPointArray = array of TPoint;
    
    
    var
      Writeln: TOneStrProc;
      GetClientWindowHandle: TSCARWindowHandle;
      FillInfo: Boolean;
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       Prison Pete
       By: Iroki
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    type
      AnimalCorner = record
        x1, y1, x2, y2: integer;
    end;
    
    
    function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean;  stdcall;
    var
      BMP: TBitmap;
      Line: PRGB32Array;
      x, y, w, h: Integer;
    
      c: array of array of Integer;
    
      Found1: Boolean;
      AnimalCorners: AnimalCorner;
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this procedure.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    procedure ColorAreaInsideBox(x1, y1, x2, y2: integer; Color1, Color2: TColor);
    var
      i, j: integer;
    begin
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color1) then c[i][j] := Color2;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts amount of pixels which are
      used to create animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountAreaInsideBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    var
      i, j, Area: integer;
    
    begin
      Area := 0;
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then Area := Area + 1;
    
      Result := Area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts colored area inside "animal".
    
      Thanks to Nava2 for the little help :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountColoredAreaInsideAnimal(x1, y1, x2, y2: integer; Color: TColor): integer;
    const
       ax : array[0..7] of ShortInt = (1, 0,-1, 0, 1, 1,-1,-1);
       ay : array[0..7] of ShortInt = (0, 1, 0,-1,-1, 1, 1,-1);
    
    var
      i, j, k, area: integer;
      tmp_bool: boolean;
    
    begin
      Area := 0;
    
      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then
          begin
    
            tmp_bool := True;
    
            for k := 0 to 7 do
              if (c[i + ax[k]][j + ay[k]] <> Color) then
              begin
                tmp_bool := False;
                break;
              end;
    
            if tmp_bool then area := area + 1;
    
          end;
    
      Result := area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function counts pixels used to create outline of animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function CountOutlineInBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    begin
    
      Result := (CountAreaInsideBox(x1, y1, x2, y2, Color) -
                 CountColoredAreaInsideAnimal(x1, y1, x2, y2, Color));
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      That lines of code was orginally created by Sky Scripter and were named "ScanFill".
      I have rewrited it completely, and now it SHOULD work properly. This procedure should
      theoreticaly find coordinates of "box" in which the baloon animal is.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    procedure FloodFillAndFindAnimalBoxCoords(x, y: integer; Color1, Color2: TColor);
    const
       xx : array[0..3] of ShortInt = (1, -1, 0, 0);
       yy : array[0..3] of ShortInt = (0, 0, 1, -1);
    
    var
      i: integer;
    
    begin
    
      if ((c[x][y] = Color1) and (x > 4) and (x < w - 4) and (y > 4) and (y < h - 4)) then
      begin
        c[x][y] := Color2;
    
        if (AnimalCorners.x1 > x) then AnimalCorners.x1 := x;
        if (AnimalCorners.x2 < x) then AnimalCorners.x2 := x;
        if (AnimalCorners.y1 > y) then AnimalCorners.y1 := y;
        if (AnimalCorners.y2 < y) then AnimalCorners.y2 := y;
    
        for i := 0 to 3 do
          FloodFillAndFindAnimalBoxCoords(x + xx[i], y + yy[i], Color1, Color2);
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this function.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindGoat(Color: TColor): boolean;
    var
      Outline, Area: integer;
    
    begin
      Result := False;
    
      Area := CountAreaInsideBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);
      Outline := CountOutlineInBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);
    
      if (InRange(Area,220, 320) and InRange(Outline, 105, 200)) then
      begin
        px := AnimalCorners.x1 + Round((AnimalCorners.x2 - AnimalCorners.x1)/2);
        py := AnimalCorners.y1 + Round((AnimalCorners.y2 - AnimalCorners.y1)/2);
    
        Result := True;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Same as above.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindCat(x1, y1, x2, y2: integer; Color: TColor): Boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsLongTail: boolean;
    
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsLongTail := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
    
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    
    
      if (how = 2) then
      begin
        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindDog(x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y,how, value,lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsDog1, IsDog2: boolean;
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsDog1 := False;
      IsDog2 := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
      if (how = 2) then
      begin
    
        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ^^
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    function FindSheep(var x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue,
      ones, twoes: integer;
      IsBigBody: boolean;
    begin
    
      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;
    
      IsBigBody := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;
    
      Result := False;
    
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((y2 - y1) < 27) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    
      if (how = 2) then
      begin
        for y := y1 to y2 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
               begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((x2 - x1) < 27)then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;
    
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Main loop (ground detecting)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    begin
      w := 516; h := 338;
      Bmp := TBitmap.Create;
      Bmp.Width := w;
      Bmp.Height:= h;
      Bmp.PixelFormat := pf32bit;
      SetLength(c, w + 1, h + 1);
      BitBlt(Bmp.Canvas.Handle, 0, 0, w, h, ClientHDC, 0, 0, SRCCOPY);
      Result := False;
    
      //finding animals and coloring red
      for y := 4 to h - 4 do
      begin
        Line := bmp.ScanLine[y];
        for x := 4 to w - 4 do
        begin
          c[x][y] := RGB(Line[x].R, Line[x].G, Line[x].B);
          if ((Line[x].G <> 0) and (Line[x].R > 150) and (Line[x].G < 120) and (Line[x].B > 120)) then
            c[x][y] := clred else c[x][y] := 0;
        end;
      end;
    
    
      Found1 := False;
      for y := 4 to h - 4 do
        for x := 4 to w - 4 do
        if (c[x][y] = clred) then
        begin
          if not Found1 then
          begin
          
            AnimalCorners.x1 := w - 4;
            AnimalCorners.x2 := 4;
            AnimalCorners.y1 := h - 4;
            AnimalCorners.y2 := 4;
    
            FloodFillAndFindAnimalBoxCoords(x, y, clred, clyellow);
    
            case AnimalId of
              1: if FindGoat(clyellow) then Found1 := True;
              2: if FindSheep(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              3: if FindCat(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              4: if FindDog(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
            end;
    
          end;
    
        end;
    
      Bmp.Free;
      if Found1 then Result := True;
    end;
    
    
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       End of Prison Pete solver.
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
    
    
    
    
    function GetFunctionCount(): Integer; stdcall; export;
    begin
      Result := 1;
    end;
    
    
    function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PAnsiChar): Integer; stdcall;
    begin
      case x of
        0:
          begin
            ProcAddr := @Pete_FindAnimal2;
            StrPCopy(ProcDef, 'function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean;');
          end;
    
      else
        x := -1;
      end;
      Result := x;
    end;
    
    
    procedure SetFunctions(Funcs: array of TSCARPlugFunc); stdcall;
    var
      i: Integer;
    begin
      for i := 0 to Length(Funcs) - 1 do
      begin
        if Funcs[i].Name = 'Writeln' then
          Writeln := Funcs[i].Ptr;
        if Funcs[i].Name = 'GetClientWindowHandle' then
          GetClientWindowHandle := Funcs[i].Ptr;
      end;
      FillInfo := false;
    end;
    
    exports GetFunctionCount;
    exports GetFunctionInfo;
    exports SetFunctions;
    
    end.
    Didn't test but it compiles. Also had to add units and get rid of Windows unit.

    Lazarus
    Simba Code:
    library libIroki;

    {$mode objfpc}{$H+}

    uses
      cmem, Interfaces, Classes, Sysutils, {Windows,} Math, Graphics, IntfGraphics, LCLIntf, LCLType;

    type
      TRGB32 = packed record
        B, G, R, A: Byte;
      end;
      TRGB32Array = packed array[0..MaxInt div SizeOf(TRGB32) - 1] of TRGB32;
      PRGB32Array = ^TRGB32Array;

      TPointArray = array of TPoint;

    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       Prison Pete
       By: Iroki

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}


    type
      AnimalCorner = record
        x1, y1, x2, y2: integer;
    end;


    function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean; stdcall;
    var
      BMP: TBitmap;
      Line: PRGB32Array;
      x, y, w, h: Integer;

      c: array of array of Integer;

      Found1: Boolean;
      AnimalCorners: AnimalCorner;



    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this procedure.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    procedure ColorAreaInsideBox(x1, y1, x2, y2: integer; Color1, Color2: TColor);
    var
      i, j: integer;
    begin

      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color1) then c[i][j] := Color2;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts amount of pixels which are
      used to create animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function CountAreaInsideBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    var
      i, j, Area: integer;

    begin
      Area := 0;

      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then Area := Area + 1;

      Result := Area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function, like the name says, counts colored area inside "animal".

      Thanks to Nava2 for the little help :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function CountColoredAreaInsideAnimal(x1, y1, x2, y2: integer; Color: TColor): integer;
    const
       ax : array[0..7] of ShortInt = (1, 0,-1, 0, 1, 1,-1,-1);
       ay : array[0..7] of ShortInt = (0, 1, 0,-1,-1, 1, 1,-1);

    var
      i, j, k, area: integer;
      tmp_bool: boolean;

    begin
      Area := 0;

      for j := y1 to y2 do
        for i := x1 to x2 do
          if(c[i][j] = Color) then
          begin

            tmp_bool := True;

            for k := 0 to 7 do
              if (c[i + ax[k]][j + ay[k]] <> Color) then
              begin
                tmp_bool := False;
                break;
              end;

            if tmp_bool then area := area + 1;

          end;

      Result := area;
    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      This function counts pixels used to create outline of animal.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function CountOutlineInBox(x1, y1, x2, y2: integer; Color: TColor): integer;
    begin

      Result := (CountAreaInsideBox(x1, y1, x2, y2, Color) -
                 CountColoredAreaInsideAnimal(x1, y1, x2, y2, Color));

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      That lines of code was orginally created by Sky Scripter and were named "ScanFill".
      I have rewrited it completely, and now it SHOULD work properly. This procedure should
      theoreticaly find coordinates of "box" in which the baloon animal is.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    procedure FloodFillAndFindAnimalBoxCoords(x, y: integer; Color1, Color2: TColor);
    const
       xx : array[0..3] of ShortInt = (1, -1, 0, 0);
       yy : array[0..3] of ShortInt = (0, 0, 1, -1);

    var
      i: integer;

    begin

      if ((c[x][y] = Color1) and (x > 4) and (x < w - 4) and (y > 4) and (y < h - 4)) then
      begin
        c[x][y] := Color2;

        if (AnimalCorners.x1 > x) then AnimalCorners.x1 := x;
        if (AnimalCorners.x2 < x) then AnimalCorners.x2 := x;
        if (AnimalCorners.y1 > y) then AnimalCorners.y1 := y;
        if (AnimalCorners.y2 < y) then AnimalCorners.y2 := y;

        for i := 0 to 3 do
          FloodFillAndFindAnimalBoxCoords(x + xx[i], y + yy[i], Color1, Color2);
      end;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      There is no need to describe this function.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function FindGoat(Color: TColor): boolean;
    var
      Outline, Area: integer;

    begin
      Result := False;

      Area := CountAreaInsideBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);
      Outline := CountOutlineInBox(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, Color);

      if (InRange(Area,220, 320) and InRange(Outline, 105, 200)) then
      begin
        px := AnimalCorners.x1 + Round((AnimalCorners.x2 - AnimalCorners.x1)/2);
        py := AnimalCorners.y1 + Round((AnimalCorners.y2 - AnimalCorners.y1)/2);

        Result := True;
      end;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Same as above.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function FindCat(x1, y1, x2, y2: integer; Color: TColor): Boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsLongTail: boolean;

    begin

      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;

      IsLongTail := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;

      Result := False;

      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;



      if (how = 2) then
      begin
        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 11) then IsLongTail := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 3) and (ones > 0) and (twoes = 2)) or ((ones = 3) and (twoes = 2)) or ((ones = 3) and (twoes = 3)) or ((ones = 2) and (twoes = 3)) or ((ones = 1) and (twoes = 4))) and (IsLongTail) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      :P
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function FindDog(x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y,how, value,lastrowvalue, tvalue, countvalue, ones, twoes: integer;
      IsDog1, IsDog2: boolean;
    begin

      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;

      IsDog1 := False;
      IsDog2 := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;

      Result := False;
      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;

      if (how = 2) then
      begin

        for y := y1 to y1 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 20) then tvalue := 2;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 1) and (countvalue > 10) then IsDog1 := True;
                  if (lastrowvalue = 2) and (countvalue > 8) then IsDog2 := True;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones = 4) and (twoes = 3)) or ((ones = 3) and (twoes = 3)) or ((ones = 3) and (twoes = 2)) or ((ones = 2) and (twoes = 3))) and (not(IsDog1)) and (not(Isdog2)) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ^^
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    function FindSheep(var x1, y1, x2, y2: integer; Color: TColor): boolean;
    var
      x, y, how, value, lastrowvalue, tvalue, countvalue,
      ones, twoes: integer;
      IsBigBody: boolean;
    begin

      if ((x2 - x1) > (y2 - y1 + 13)) then how := 1
        else if ((x2 - x1) < (y2 - y1 + 13)) then how := 2
          else how := 3;

      IsBigBody := False;
      lastrowvalue := 1;
      countvalue := 0;
      ones := 0;
      twoes := 0;

      Result := False;

      if (how = 1)then
      begin
        for x := x1 to x2 do
        begin
          value := 0;
          for y := y1 to y2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
                begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((y2 - y1) < 27) then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;


      if (how = 2) then
      begin
        for y := y1 to y2 do
        begin
          value := 0;
          for x := x1 to x2 do
            if (c[x][y] = Color) then inc(value);
          tvalue := 0;
          if (value <= 5) and (value > 0) then tvalue := 1;
          if (value > 5) and (value < 15) then tvalue := 2;
          if (value > 15) and (value < 45) then tvalue := 3;
          if not(tvalue <> 1) or not(tvalue <> 2) or not(tvalue <> 0) or not(tvalue <> 3) then
          begin
            if (lastrowvalue = tvalue) then
            begin
              inc(countvalue);
            end else
            begin
              if (countvalue <> 0) and (lastrowvalue <> 0) then
              begin
                if (countvalue > 2) or (lastrowvalue = 2) then
               begin
                  if (lastrowvalue = 1) then inc(ones);
                  if (lastrowvalue = 2) and (countvalue > 11)  then IsBigBody := True;
                  if (lastrowvalue = 2) and (countvalue > 27) then IsBigBody := False;
                  if (lastrowvalue = 2) then inc(twoes);
                end;
                countvalue := 1;
                lastrowvalue := tvalue;
              end;
            end;
          end;
        end;
        if (((ones < 4) and (ones > 0)) and ((twoes > 0) and(twoes < 3))) and (IsBigBody) and ((x2 - x1) < 27)then
        begin
          px := x1 + Round((x2 - x1)/2);
          py := y1 + Round((y2 - y1)/2);
          Result := True;
        end;
      end;

    end;
    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}




    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Main loop (ground detecting)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

    var
      t: TLazIntfImage;
    begin
      w := 516; h := 338;
      Bmp := TBitmap.Create;
      Bmp.Width := w;
      Bmp.Height:= h;
      Bmp.PixelFormat := pf32bit;
      SetLength(c, w + 1, h + 1);
      BitBlt(Bmp.Canvas.Handle, 0, 0, w, h, ClientHDC, 0, 0, SRCCOPY);
      Result := False;

      //finding animals and coloring red
      t := bmp.CreateIntfImage;
      try
        for y := 4 to h - 4 do
          for x := 4 to w - 4 do
          begin
            c[x][y] := RGB(t.Colors[x, y].red, t.Colors[x, y].green, t.Colors[x, y].blue);
            if ((t.Colors[x, y].green <> 0) and (t.Colors[x, y].red > 150) and (t.Colors[x, y].green < 120) and (t.Colors[x, y].blue > 120)) then
              c[x][y] := clred
            else
              c[x][y] := 0;
          end;
      finally
        t.Free;
      end;


      Found1 := False;
      for y := 4 to h - 4 do
        for x := 4 to w - 4 do
        if (c[x][y] = clred) then
        begin
          if not Found1 then
          begin

            AnimalCorners.x1 := w - 4;
            AnimalCorners.x2 := 4;
            AnimalCorners.y1 := h - 4;
            AnimalCorners.y2 := 4;

            FloodFillAndFindAnimalBoxCoords(x, y, clred, clyellow);

            case AnimalId of
              1: if FindGoat(clyellow) then Found1 := True;
              2: if FindSheep(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              3: if FindCat(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
              4: if FindDog(AnimalCorners.x1, AnimalCorners.y1, AnimalCorners.x2, AnimalCorners.y2, clyellow) then Found1 := True;
            end;

          end;

        end;

      Bmp.Free;
      if Found1 then Result := True;
    end;

    {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       End of Prison Pete solver.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}


    function GetFunctionCount(): Integer; stdcall; export;
    begin
      Result := 1;
    end;

    function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall; export;
    begin
      case x of
        0: begin
            ProcAddr := @Pete_FindAnimal2;
            StrPCopy(ProcDef, 'function Pete_FindAnimal2(var px, py: Integer; AnimalId: Integer; ClientHDC: HDC): Boolean;');
          end;
        else
          x := -1;
      end;
      Result := x;
    end;

    exports GetFunctionCount;
    exports GetFunctionInfo;

    initialization
    end.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  8. #83
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Updated the list a bit.

    Would be nice to get some more activity towards SRL's solvers!

    Feedback is a good place to start

  9. #84
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    I level'd my guys a bit with an auto fighter recently. So I'll set them up on MSI again to have them get some randoms going...When I get home tonight.... MSI still uses SRL randoms and not Ref Randoms right?

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  10. #85
    Join Date
    Feb 2009
    Posts
    1,447
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    MSI still uses SRL randoms and not Ref Randoms right?
    That's right. MSI uses refleciton only for walking.

  11. #86
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    I level'd my guys a bit with an auto fighter recently. So I'll set them up on MSI again to have them get some randoms going...When I get home tonight.... MSI still uses SRL randoms and not Ref Randoms right?

    ~BraK
    Quote Originally Posted by TRiLeZ View Post
    That's right. MSI uses refleciton only for walking.
    It actually depends on what you set it to. If you choose to use Reflection walking, then MSI will use Reflection randoms.

    You can change this by opening Antiban.simba and changing line 405 to this:
    Simba Code:
    randomDone := FindNormalRandoms //R_FindRandoms

  12. #87
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    It actually depends on what you set it to. If you choose to use Reflection walking, then MSI will use Reflection randoms.

    You can change this by opening Antiban.simba and changing line 405 to this:
    Simba Code:
    randomDone := FindNormalRandoms //R_FindRandoms
    That's what I thought I'll check it when I get home. I most time use Reflection walking because I have my players everywhere or don't know exactly where they are.

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  13. #88
    Join Date
    Mar 2007
    Location
    USA
    Posts
    1,433
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I got a ScapeRune account... or is that Evil Bob?

    Shows it as working fine with no known problems, but this script was using ref 2. Is there a different dev section for those randoms? Who should I contact with the account?

    EDIT: Nvm found the ref 2 thread.
    Last edited by Silent; 08-09-2011 at 12:42 AM.
    I'm Silent SPY
    Secret project: 0%
    Need help? Send me a PM

  14. #89
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Silent SPY View Post
    I got a ScapeRune account... or is that Evil Bob?

    Shows it as working fine with no known problems, but this script was using ref 2. Is there a different dev section for those randoms? Who should I contact with the account?

    EDIT: Nvm found the ref 2 thread.
    This thread is strictly for SRL's random solvers, so it won't match up to anything for reflection.

  15. #90
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Player went false saying it failed Drill Demon, but wasn't in the random. Seemed to solve perfectly.
    Progress Report:
    ***** STR: FOUND RANDOM: 'Drill Demon' *****
    Screenshot of: Found Drill Demon random 15 Hours, 1 Minutes and 24 Seconds
    Screenshot of: Found Demon 15 Hours, 1 Minutes and 27 Seconds
    Push
    1: Jog mat
    2: Sit-up mat
    3: Push-up mat
    4: Star Jump mat
    Star
    1: Star Jump mat
    2: Jog mat
    3: Sit-up mat
    4: Push-up mat
    Push
    DemonCenter - We are at the edge of the random area, fixing position.
    1: Star Jump mat
    2: Push-up mat
    3: Sit-up mat
    4: Jog mat
    Sit
    1: Sit-up mat
    2: Push-up mat
    3: Jog mat
    4: Star Jump mat
    Jog
    DemonCenter - We are at the edge of the random area, fixing position.
    1: Push-up mat
    2: Jog mat
    3: Sit-up mat
    4: Star Jump mat
    ***** STR: 'Drill Demon' RANDOM SOLVING FAILED! *****
    E: PM'ing you ac account in Mordaut Exam.
    Last edited by Coh3n; 08-10-2011 at 08:58 PM.

  16. #91
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    Player went false saying it failed Drill Demon, but wasn't in the random. Seemed to solve perfectly.
    Progress Report:
    ***** STR: FOUND RANDOM: 'Drill Demon' *****
    Screenshot of: Found Drill Demon random 15 Hours, 1 Minutes and 24 Seconds
    Screenshot of: Found Demon 15 Hours, 1 Minutes and 27 Seconds
    Push
    1: Jog mat
    2: Sit-up mat
    3: Push-up mat
    4: Star Jump mat
    Star
    1: Star Jump mat
    2: Jog mat
    3: Sit-up mat
    4: Push-up mat
    Push
    DemonCenter - We are at the edge of the random area, fixing position.
    1: Star Jump mat
    2: Push-up mat
    3: Sit-up mat
    4: Jog mat
    Sit
    1: Sit-up mat
    2: Push-up mat
    3: Jog mat
    4: Star Jump mat
    Jog
    DemonCenter - We are at the edge of the random area, fixing position.
    1: Push-up mat
    2: Jog mat
    3: Sit-up mat
    4: Star Jump mat
    ***** STR: 'Drill Demon' RANDOM SOLVING FAILED! *****
    E: PM'ing you ac account in Mordaut Exam.
    For the demon account, the InRandom function must have returned true for some reason. Hard to tell without being able to watch it solve. :/

    I know for a fact that the mordaut solver doesn't work right now and I don't really have an idea that hasn't been attempted, or the time to try that solver right now. However, I can make sure that SRL's detection for the random works and effectively logs the player out so it's at least not just hanging out in the random until the script messes up or anything.

    I'll let you know after I have checked it out.

  17. #92
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Okay. The Mordaut account was using Reflection randoms, so everything may be okay with the SRL Solver (logging out on detection I mean).

  18. #93
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by SRL commit log
    Fixed Evil Bob solver and committed a few small tweaks to some others.
    Hope your all happy, I sacrificed my bonus XP for you! (Jokes, I'm not really worried about it.)

    Evil Bob is working well again and the others were some tweaks I had made since my last commit that just weren't big enough to commit by themselves.

  19. #94
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Evil Bob is working well again and the others were some tweaks I had made since my last commit that just weren't big enough to commit by themselves.
    You should commit things as soon as they're ready, regardless of how big it is.

    Nice work, though.

  20. #95
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Bumpydump, the list on frontpage needs some updating.
    I made a new script, check it out!.

  21. #96
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Markus View Post
    Bumpydump, the list on frontpage needs some updating.
    Oops, forgot about this thread

    Edit: All up to date.
    Last edited by NCDS; 11-02-2011 at 12:17 AM.

  22. #97
    Join Date
    Sep 2010
    Location
    Northern Kentuckeh
    Posts
    759
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I just encountered the frog random and it logged me out
    Quote Originally Posted by h_king1998 View Post
    how come it does not bank in al-kharid when i do mine 1 drop 1

  23. #98
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by doublex8 View Post
    I just encountered the frog random and it logged me out
    If you can't post the debug that would be helpful.

  24. #99
    Join Date
    Sep 2010
    Location
    Northern Kentuckeh
    Posts
    759
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Progress Report:
    [ ] ------ ~ Track Record
    [ ] ------ ~ ~ TrackObject
    [ ] ------ ~ ~ Searches: 768
    [ ] ------ ~ ~ Successes: 731
    [ ] ------ ~ ~ Success %: 95
    [ ] ---- MSI_TrackObject: False
    [ ] ---- MSI_WaitWhileMining
    [ ] ------ Distance from tracking box to player = 12
    [ ] ------ InvCount: 0
    [ ] ------ Colours found < Accuracy
    [ ] ---- MSI_WaitWhileMining: Finished
    [ ] ---- MSI_FindObjectTPA: ROCK_MITHRIL
    [ ] ------ Took 78 ms to complete
    [ ] ---- MSI_FindObjectTPA: False
    [ ] ------ Scanning for randoms...
    [ ] ------ MSI_FindRandoms: Finished Random Event!
    [ ] -- MSI_AutoObjects: False
    [ ] -- Went inactive somewhere in SRL
    [ ] -- MSI_UnsetPlayer
    [ ] ---- Failed to use script: Lumby Swamp West Miner
    [ ] ------ All players inactive


    EDIT: I tried running the script again while I was in the random and it did try to start solving it, except since I canceled the herald's spiel it kept trying to click the princess because it thought I had already talked to him I think. Not sure, I'll keep him in there in case you need him.

    EDIT2: I have an account in Leo if anyone is interested.
    Last edited by doublex8; 11-03-2011 at 04:28 PM.
    Quote Originally Posted by h_king1998 View Post
    how come it does not bank in al-kharid when i do mine 1 drop 1

  25. #100
    Join Date
    Oct 2011
    Posts
    62
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sandwich lady random failed...



    Anyone want the account?

Page 4 of 5 FirstFirst ... 2345 LastLast

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
  •