Results 1 to 8 of 8

Thread: ?Find Dead center of minimap dot?

  1. #1
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default ?Find Dead center of minimap dot?

    How can I find the dead center of a minimap dot? I've been thinking about it for some time and it's been taking me forever to come up with an idea so I thought I'd ask here.

    This is what I have to debug minimap dots and items on the floor that are related to those dots..

    It paints the pixel on the dot that is found, BLUE. The thing is.. It does not paint the one right in the center! It always paints the one closest to me :c

    Also I cannot figure out how to get it to accurately find the dot center because some dots overlap! huge problem there. It gets sooooo close to the item tile.. but yet so far due to being 1 pixel off on the minimap :c Each dot is exactly 12 pixels in size. Not including the black shadow.

    Dots:


    What I want it to paint:

    <---- See how I coloured the dead center of the dot? That's what I want to paint.. Just that one pixel.


    Accuracy Loss Due to one pixel:



    Debugger Script:

    Simba Code:
    program New;
      {$define SMART}
      {$i srl/srl.scar}
      {$i srl/srl/skill/fighting.scar}
      {$i sps/sps.simba}
      {$i SRL/SRL/misc/paintsmart.scar}

    Procedure DrawBox(B: TBox; Time: Integer);
    Var
      T: Integer;
      drawing : TBitmap;
    Begin
      drawing := TBitmap.Create;
      drawing.canvas.handle := SmartGetDebugDC;
      ClearRSCanvas(Drawing.Canvas);
      drawing.canvas.Pen.Color := CLBLUE;
      MarkTime(T);
      Repeat
        drawing.canvas.MoveTo(B.X1,B.y1);
        drawing.canvas.LineTo(B.X2,B.y1);
        drawing.canvas.LineTo(B.X2,B.y2);
        drawing.canvas.LineTo(B.X1,B.y2);
        drawing.canvas.LineTo(B.X1,B.y1);
        Wait(2);
      Until(TimeFromMark(T) > Time);
    End;

    //By Mormonman..
    procedure SortATPAFromMidPoint(var a: T2DPointArray; const From: TPoint);
    var
       i, l: Integer;
       DistArr: TIntegerArray;
       MidPt: TPoint;
    begin
      l := High(a);
      if (l < 0) then Exit;
      SetLength(DistArr, l + 1);
      for i := 0 to l do
      begin
        MidPt := MiddleTPA(a[i]);
        DistArr[i] := Round(Sqr(From.x - MidPt.x) + Sqr(From.y - MidPt.y));
      end;
      QuickATPASort(DistArr, a, 0, l, True);
    end;

    Function FindColorMM(Colors: TIntegerArray; var X, Y: Integer; Width, Height, tol: integer): Boolean;
      var
          I: integer;
          TPA: TPointArray;
          ATPA: T2DPointArray;

      begin
        SetLength(TPA, Length(Colors));

        For I:= 0 To High(Colors) do
          FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[i], MMX1, MMY1, MMX2, MMY2, tol); //Find colours starting from the middle outwards..

        FilterPointsPie(TPA, 0.0, 360.0, 0.0, 76.0, MMCX, MMCY);  //Filter them so they are on the MM itself..
        ATPA:= TPAToATPAEx(TPA, Width, Height);                  //Group TPA into cirles by Distance..
        SortATPAFromFirstPoint(ATPA, Point(MMCX, MMCY));            //Sort the colours from the closest to the center.. AKA Me..
        if(Length(ATPA) = 0) then
          Exit;

        MiddleTPAEx(ATPA[0], X, Y);                       //In that 2D Array, Pick out the closest to the middle a.k.a. the first one..
        if(X AND Y <> 0) then
          Result:= True;
      end;

    Function MMtoMSEx(mm: TPoint): TPoint;
    var
      X, Y, Yh: integer;
    begin
      X := (mm.x-627);
      Y := (mm.y-85);
      Yh := round(abs(mm.y-104));

      Result := Point(Round((X*3.0/(Yh/42+3))*((10.015))+258.5), Round(168+Y*(8.0)));
      if not PointInBox(Result, MSBox) then
        Result := Point(-1, -1);
    end;

    Procedure PickUpItems(Items: TStringArray);
    var
      x, y: Integer;
      Item: TPoint;
      MS, Box: TBox;
    begin
      if FindColorMM([591083], X, Y, 0, 0, 20) then
      begin
         Box:= IntToBox(X - 1, Y - 1, X + 1, Y + 1);
         DrawBox(Box, 300);
         Item:= MMToMS(Point(X, Y));
         MS:= IntToBox(MSX1, MSY1, MSX2, MSY2);
         if PointInBox(Item, MS) then
         begin
            MMouse(Item.X, Item.Y, 0, 0);
            Box:= IntToBox(Item.X - 10, Item.y - 10, Item.x + 10, Item.y + 10);
            DrawBox(Box, 300);
         end;
      end;
    end;

    begin
      Smart_Server := 45;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;

      SetupSRL;
      repeat
        PickupItems(['harm', 'eath rune', 'lood rune', 'oul rune', 'rune', 'essence', 'ak plank', 'eak plank']);
      until(false);
    end.
    I am Ggzz..
    Hackintosher

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    There is no center, unless you go to Extended.

    E:
    We would have to use Extended points for MMtoMS to work better.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    So basically, you're trying to paint the dots blue even if they overlap? Sorry, I'm just confused on the whole post.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    There is no center, unless you go to Extended.

    E:
    We would have to use Extended points for MMtoMS to work better.

    Ahhh I see :c I was hoping it would actually be easier. One pixel off actually matters now *sigh* I'll live though. My item finding is perfect other than that.. Just that one pixel throws it off by exactly one tile which I can probably compensate for by using a +- 1 in my function.

    @Camo.. I'm trying to paint the center of the red dot closest to me. Problem is that some dots actually overlap so its hard to find a center but like Narcle said, I cannot get the center unless we used extended points which don't exist afiak? because all TPoints are int x, int y.

    Edit: Now that there are no extended points, is there a way to paint the four pixels in the center of the dot?
    Edit2: I added a picture to show the accuracy of one pixel in the first post. Usually off by a tile.
    I am Ggzz..
    Hackintosher

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I have an idea I'll post after I get back from work.

    Edit:
    So first off the function is incomplete. I still haven't compensated for Y value yet. Second you can just -0.5 from both points to make it center of dot inside MMtoMS.

    This will NEVER be accurate we can only get close.
    Last edited by Narcle; 12-28-2011 at 06:31 PM.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    I have an idea I'll post after I get back from work.

    Edit:
    So first off the function is incomplete. I still haven't compensated for Y value yet. Second you can just -0.5 from both points to make it center of dot inside MMtoMS.

    This will NEVER be accurate we can only get close.
    Do you mean the pickup items is incomplete? Because I only intended to hover over it for this post in-order to see how close I can get the mouse to it. And -0.5 from which two points?
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Jan 2011
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The problem is that there is no center - the dots are 4 pixels across, so the center is the intersection of 4 pixels. Finding items from the MM is okay to move your char to the general vicinity, but you should generally be using TPA object finding to actually locate the items on the MS.

  8. #8
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by legoace View Post
    The problem is that there is no center - the dots are 4 pixels across, so the center is the intersection of 4 pixels. Finding items from the MM is okay to move your char to the general vicinity, but you should generally be using TPA object finding to actually locate the items on the MS.
    You know how hard that is to find bones on a background that is the almost the exact same colour as the bone? Even using ACA with CTS 2, I couldn't do it.. 100 colours and it still couldn't find the bones.. It found the whole place instead.. It's the same with differentiating pure essence vs super strength..

    Plus I'd have to make a TPA for each and every item.. what about when I'm standing on it or another person is.. Or fighting in an area with a large amount of items on the floor.. it'd have to loop through every single one of those. Finding charms is pretty ridiculous on the floor.
    I am Ggzz..
    Hackintosher

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
  •