Results 1 to 2 of 2

Thread: find fish

  1. #1
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default find fish

    SCAR Code:
    program new;

    function within(a,b,c:integer):boolean;
    begin
         result := true;
         if a > b then
         begin
              a := a - c;
              if a > b then
                 result := false;
         end else
         begin
              a := a + c;
              if a < b then
                 result := false;
         end;
    end;

    function FindFish(fishtype:string):TPoint;
    var   i,c,x,y:integer;
          tpa,ttpa: TPointArray;
          t:boolean;
    begin
       FindColors(tpa,16025680,0,0,511,400);
       t := true;
       i := 0;
       c := 1;
       x := 0;
       if length(tpa) = 0 then
          exit;
       while t do
       begin
          if i+c = high(tpa) then
          begin
             SetArrayLength(ttpa,x+1);
             ttpa[x] := tpa[i];
             t := false;
          end;
          if within(tpa[i].x,tpa[i+c].x,30) and within(tpa[i].y,tpa[i+c].y,30) then
          begin
             tpa[i].x := (tpa[i].x + tpa[i+c].x)/2
             tpa[i].y := (tpa[i].y + tpa[i+c].y)/2
             c := c + 1;
          end else
          begin
             SetArrayLength(ttpa,x+1);
             ttpa[x] := tpa[i];
             x := x + 1;
             i := i + c;
             c := 1;
             if i = high(tpa) then
                t := false;
          end;
       end;
       for i := 0 to high(ttpa) do
       begin
          tpa[i] := Point(i, Distance(ttpa[i].x,ttpa[i].y,255,160));
       end;
       for i := 0 to high(ttpa) do
       begin
          if tpa[i].y >
       end;
    end;

    var pt:tpoint;

    begin
       pt := FindFish('a');
       writeln(inttostr(pt.x) + ',' + inttostr(pt.y));
    end.

    this isn't complete, right now the ttpa array returns locations of all fishing spots found, problem is, is that they're supposed to be the averages of all points found instead of the first one

    also i want to arrange ttpa from lowest to highest y value of tpa[0] upto tpa[high(ttpa)], cause that's the distance between the character and specific fishing spot, the x value of that point is the ttpa location of the spot, whilst y value is the distance

    hope you understood what i was trying to say haha hard to explain

  2. #2
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Check srl -> misc -> wizzy plugin. You could use t2dpoint arrays and middletpa

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
  •