Results 1 to 16 of 16

Thread: FindRoadColor error in Seers

  1. #1
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindRoadColor error in Seers

    FindRoadColor does not work when used in Seers bank.
    It instead returns the color of the floor.
    Now I have tried to create my own function specific for Seers bank but I cannot seem to get it right.
    I have tried bitmaps, color comparison, dtms, ddtms none of which seem to hold out in the long run.

    Does anyone have any suggestions for how I could get this to work?

    Edit: Using my newly found interest in TPAs I have created a function specific for Seers Bank...

    Here it is for anyone wondering... and also for me to show off

    SCAR Code:
    function MyFindRoadColor : Integer;
    var
      BaseC, Tol, BigArray, i, HighColor, Color : Integer;
      ColorTPA : TPointArray;
      ColorTPAs : T2DPointArray;
      ColorPt : TPoint;
    begin
      BaseC := 7171445;
      Tol := 20;
      FindColorsPie(ColorTPA, BaseC, Tol, 85, 95, 35, MMX2-MMCX, MMX1, MMCY, MMX2, MMY2, MMCX, MMCY);
      ColorTPAs := SplitTPA(ColorTPA, 3);
      BigArray := 0;
      HighColor := High(ColorTPAs);
      WriteLn(InttoStr(HighColor));
      if (HighColor > 0) then
        begin
          for i := 1 to HighColor do
            begin
              if (High(ColorTPAs[i]) > High(ColorTPAs[BigArray])) then
                BigArray := i;
            end;
        end;
      ColorPt := MiddleTPA(ColorTPAs[BigArray]);
      Color := GetColor(ColorPt.x, ColorPt.y);
      WriteLn('The color is ' + InttoStr(Color));
      result := Color;
    end;

    I prolly messed up the Bounds with HighColor... if any problems come up ill edit them later.

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    You can make a Bitmap of the road, then use AutoColorThis(...);


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I did that, it didnt work althought I don't really know how AutoColorThis works:
    Does it return the color at the point 1,1 on the bitmap, the most common color, or what?

  4. #4
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    You only make a BMP of the object, so you only make the bitmap of the road color.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  5. #5
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh ok so id black out all the surrounding stuff like the grass...
    so im left with a section of the road with the black surrounding?

  6. #6
    Join Date
    Feb 2008
    Location
    Manteca, CA
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes sort of like a mask. So just use that. But can't you find the color of the road and do If FindColorTolerance(TheColor, MMX1, MMY1, MMX2, MMY2, 10) then blabla? Thanks,

    ~Burrito~

    Edit:

    @Hy Lol you changed your sig to Mad At Sporky . Is that because of that whole spamming incident in that 1 thread? Where he spammed and posted '.' lol.

  7. #7
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I tried to do that but its not working... it keeps returning 0 as the color.

    here's the image... could someone mark up a good area to use?


  8. #8
    Join Date
    Feb 2008
    Location
    Manteca, CA
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, It looks like the floor is the same color as the road . So that wouldn't work. I don't really know how to fix this...I'll see what I can do..

  9. #9
    Join Date
    Mar 2007
    Location
    Ohio
    Posts
    138
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    make a DDTM of the 3-way intersection and use FindRoadColor; as road color and if that doesnt work than idk

  10. #10
    Join Date
    Jun 2007
    Posts
    246
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Im guessing its because the color of the road isnt the same and findroadcolor checks for the same road color so thats probably the problem.

  11. #11
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've tried several DDTM's especially with that intersection. They always seem to bug up over time.

  12. #12
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Did you use DTMRotated, or just FindDTM?


    DTMRotated should work great on that intersection.

    Or another option would be to copy the entire FindRoadColor function into your script, rename it, and change it so that it searches from the bottom right corner of the minimap. The first color it should run into would have to be the correct road color.

    Pretty much all you would have to change is one line.

    FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 50);

    Change to

    FindColorsSpiralTolerance(MMX2, MMY2, P, GC, MMX1, MMY1, MMX2, MMY2, 50);

    You could use modified one anytime you're near the Seers' bank, and the normal one the rest of the time.


  13. #13
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea I tried that too(with DTMRotated duh )... It didnt work for me. (I prolly messed up the params)

    but I made a function that seems to be working using FindColorsPie and searching with a min radius outside of the bank.

    I put it up in the first post.

  14. #14
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Oh noes! You can't just simply do a MiddleTPA and get the color there, because for example if we had this X -axises in the TPA -

    1, 2, 9

    1 + 2 + 9 = 12

    12 / 3 = 4

    No such X as 4 exists there, so you should instead do a GetColors,
    ClearSameIntegers and then just compare the colors

  15. #15
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by markuska815 View Post
    FindRoadColor does not work when used in Seers bank.
    It instead returns the color of the floor.
    Now I have tried to create my own function specific for Seers bank but I cannot seem to get it right.
    I have tried bitmaps, color comparison, dtms, ddtms none of which seem to hold out in the long run.

    Does anyone have any suggestions for how I could get this to work?

    Edit: Using my newly found interest in TPAs I have created a function specific for Seers Bank...

    Here it is for anyone wondering... and also for me to show off

    SCAR Code:
    function MyFindRoadColor : Integer;
    var
      BaseC, Tol, BigArray, i, HighColor, Color : Integer;
      ColorTPA : TPointArray;
      ColorTPAs : T2DPointArray;
      ColorPt : TPoint;
    begin
      BaseC := 7171445;
      Tol := 20;
      FindColorsPie(ColorTPA, BaseC, Tol, 85, 95, 35, MMX2-MMCX, MMX1, MMCY, MMX2, MMY2, MMCX, MMCY);
      ColorTPAs := SplitTPA(ColorTPA, 3);
      BigArray := 0;
      HighColor := High(ColorTPAs);
      WriteLn(InttoStr(HighColor));
      if (HighColor > 0) then
        begin
          for i := 1 to HighColor do
            begin
              if (High(ColorTPAs[i]) > High(ColorTPAs[BigArray])) then
                BigArray := i;
            end;
        end;
      ColorPt := MiddleTPA(ColorTPAs[BigArray]);
      Color := GetColor(ColorPt.x, ColorPt.y);
      WriteLn('The color is ' + InttoStr(Color));
      result := Color;
    end;

    I prolly messed up the Bounds with HighColor... if any problems come up ill edit them later.
    Well, I think you want to see what 'color' (in tolerance with a certain roadcolor) exists most, right?
    That won't work with TPA's like that.
    You should do a FindColors, then a GetColors, split those into an Array Of Array Of Integer. (Each Array holds the colors) Then get the array in the array of array of integer with the highest length.

    Let me dig up some old (different) code:
    SCAR Code:
    FindColorsTolerance(Points, RoadColor, MMX1, MMY1, MMX2, MMY2, 50);
      Points := ClearTPointArray(Points); // just takes out all points not on the MM
      Colors := ShrinkArray(GetColors(Points)); //If there are multiple (of the same integers, it removes them)
      SetArrayLength(MyAmount, GetArrayLength(Colors));

      For I := 0 To GetArrayLength(Colors) - 1 Do
      Begin
        MyAmount[i] := CountColor(Colors[I], MMX1, MMY1, MMX2, MMY2);
       // If Amount[I] > 50 Then WriteLn('Color ' + IntToStr(Colors[I]) + ': '+IntToStr(Amount[I]));
      End;

      For I := 0 To GetArrayLength(Colors) - 1 Do
      Begin
        If MyAmount[I] > 200 Then // You might want to tweak the 200.
        Begin
          SetArrayLength(Amount2, GetArrayLength(Amount2) + 1);
          SetArrayLength(Colors2, GetArrayLength(Colors2) + 1);
          Amount2[GetArrayLength(Amount2) - 1] := MyAmount[I];
          Colors2[GetArrayLength(Colors2) - 1] := Colors[I];
        End;
      End;



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  16. #16
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks guys yea that makes sense... I knew my function was off. I was trying to find a get colors but didnt know where it was... i knew there was one

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FindRoadColor
    By Bobzilla69 in forum Research & Development Lounge
    Replies: 2
    Last Post: 07-03-2008, 07:17 AM
  2. FindRoadColor Problem
    By jackkat in forum OSR Help
    Replies: 4
    Last Post: 06-02-2007, 09:14 PM
  3. FindRoadColor?
    By 3Garrett3 in forum OSR Help
    Replies: 7
    Last Post: 05-08-2007, 09:27 PM

Posting Permissions

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