Results 1 to 7 of 7

Thread: Help with RadialWalk

  1. #1
    Join Date
    Nov 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with RadialWalk

    Basically, I've got everything else working but I can't for the life of me figure out how to make RadialWalk search in the correct area, like so:
    It should search in that area with -20 and 20, or 340 and 380, or 700 and 740, or anything like that, right?
    Instead, seemingly no matter which variation of '-20, 20' I put into the function, it searches in this kind of area:

    I can tell because it walks south when it's supposed to be walking north. Also, these images are not the exact location I'm having this problem in.

    Please help, I'm stumped.

    The specific function I'm using is RadialWalkTolerance, if that makes a difference
    Last edited by APinAP; 02-19-2012 at 09:50 PM.

  2. #2
    Join Date
    Nov 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    58 views and not a single response? Come on, guys

  3. #3
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Use 340,20. And here is the proof

    Simba Code:
    program new;

    function getBlackSquare:TPointArray;
    var
      x,y:Integer;
    begin
      setLength(result,100*100);
      for x := 0 to 99 do
        for y := 0 to 99 do
          result[x*100+y] := Point(x,y);
    end;

    var
      points:TPointArray;
      bitmap:integer;

    begin
      DisplayDebugImgWindow(100,100);

      points := getBlackSquare;

      FilterPointsPie(points,340,20,0,100,50,50);  //as you can see,340 and 20 works like a charm

      bitmap := CreateBitmap(100,100);

      DrawTPABitmap(bitmap,points,2927209);

      DrawBitmapDebugImg(bitmap);
    end.
    Working on: Tithe Farmer

  4. #4
    Join Date
    Nov 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's still doing it, even though the FilterPointsPie snippet seems to do it fine.
    See here:
    http://dl.dropbox.com/u/9623428/scre...%20won%27t.png
    http://dl.dropbox.com/u/9623428/screenies/you.png
    http://dl.dropbox.com/u/9623428/screenies/work.png

    The 3rd screenshot is from the moment when it clicks on the road to the south instead of the road to the north. I can make this mostly work by making it walk a bit more to the east and then searching between 340 and 359, though, but that's suboptimal and a bit unreliable.

    I checked in mapwalk.simba and I think this might be the cause:

    Simba Code:
    if (SD > ED) then
        Swap(SD, ED);

    That's in RadialWalkEx, the function that the other radialwalks seem to be built from, and SD is variantToDirection(StartRadial) and ED variantToDirection(EndRadial)

    Testing results:

    versus


    RadialWalkEx for reference:
    Simba Code:
    function RadialWalkEx(var TPA: TPointArray; cx, cy, TheColor, tol: Integer; StartRadial, EndRadial: Variant; Radius: Integer): Boolean;
    var
      time: Integer;
      SD, ED: extended;
    begin
      Result := False;
      if (not LoggedIn) then Exit;

      SD := variantToDirection(StartRadial);
      ED := variantToDirection(EndRadial);
      if (SD = ED) then
      begin
        srl_Warn('RadialWalkEx', 'StartRadial = EndRadial, using LinearWalkEx.', warn_Warning);
        Result := LinearWalkEx(tpa, cx, cy, TheColor, tol, StartRadial, Radius);
      end;
      if (SD > ED) then
        Swap(SD, ED);

      time := GetSystemTime;
      try
        FindColorsTolerance(tpa, TheColor, MMX1, MMY1, MMX2, MMY2, tol);
        FilterPointsPie(tpa, SD, ED, 10, Radius, cx, cy);
        SortCircleWise(tpa, cx, cy, StartRadial, False, StartRadial > EndRadial);
        Result := (Length(tpa) > 0);
      except
        srl_Warn('RadialWalkEx', 'An exception has occured', warn_AllVersions); Exit;
      end;
      srl_Warn('RadialWalkEx', 'Took ' + IntToStr(GetSystemTime - time) +
        ' ms, found' + IntToStr(Length(TPA)) + ' points', warn_Debug);
    end;
    Last edited by APinAP; 02-20-2012 at 04:18 PM.

  5. #5
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    I will find this out.
    Working on: Tithe Farmer

  6. #6
    Join Date
    Nov 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks in advance

  7. #7
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Working on: Tithe Farmer

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
  •