Results 1 to 13 of 13

Thread: Confuzzled..

  1. #1
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Confuzzled..

    I need help with Nielsie's FastFindLadderColor(At least i think that's the problem..) cause i started having issues with my script after i added this.. The issue is that my whenever i use that function, my script finds the ladder color fine and whatnot, but doesn't start walking there and says nextplayer.. Help is greatly appreciated..

    SCAR Code:
    {------------------------------------------------------------------------------]
    [ function FastFindLadderColor: Integer;                                       ]
    [ by: Nielsie95                                                                ]
    [ Description: Returns the current color of the ladder.                        ]
    {------------------------------------------------------------------------------}

    function FastFindLadderColor: Integer;
    var
      i, c, n, bmp, Handle, cts:Integer;
      p: TPointArray;
      ca: TIntegerArray;
      pa: T2DPointArray;
      W, H, S, L: Extended;
    begin
      if (not LoggedIn) then Exit;
      bmp := BitmapFromString(MMX2 - MMX1, MMY2 - MMY1, '');
      CopyClientToBitmap(bmp, MMX1, MMY1, MMX2, MMY2);
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      Handle := GetClientWindowHandle;
      SetTargetBitmap(bmp);
      FindColorsSpiralTolerance(MMCX - MMX1, MMCY - MMY1, p, 79973, 0, 0, MMX2 - MMX1, MMY2 - MMY1, 55);
      pa := SplitTPAEx(p, 2, 2);
      n := Length(pa) -1;
      SortATPAFromSize(pa, 32, True);
      for i := 0 to n do
        if (Length(pa[i]) > 15) and (Length(pa[i]) < 42) then
        begin
          c := FastGetPixel(bmp, pa[i][0].x, pa[i][0].y);
          //WriteLn(IntToStr(c)+'   '+IntToStr(Length(pa[i])));
          ColorToHSL(c, H, S, L);
          if (H < 11.0) and (H > 4.5) then
            if (L < 30.0) and (L > 10.0) then
            begin
              ca := GetColors(pa[i]);
              ClearSameIntegers(ca);
              if (Length(ca) = 1) then
              begin
                p := ReArrangeTPA(pa[i], 0, Length(pa[i]), True, True);
                w := Abs(p[0].x - p[Length(p) -2].x);
                p := ReArrangeTPA(pa[i], 0, Length(pa[i]), False, True);
                h := Abs(p[0].y - p[Length(p) -2].y);
                WriteLn('Color: '+IntToStr(c)+'w: '+FloatToStr(w)+' h: '+ FloatToStr(h));
                WriteLn('ratio: '+FloatToStr(MaxE(w, h) div MinE(w, h)));
                if (MaxE(w, h) div MinE(w, h) >= 1.12) and (MaxE(w, h) div MinE(w, h) <= 1.8) then
                begin
                  Result := c;
                  Break;
                end;
              end;
            end;
        end;
      SetLength(p, 0);
      SetLength(pa, 0);
      SetClientWindowHandle(Handle);
      FreeBitmap(bmp);
      ColorToleranceSpeed(cts);
    end;



    {------------------------------------------------------------------------------]
    [ procedure ToRange;                                                           ]
    [ by: Itschris917                                                              ]
    [ Description: Walks to the range.                                             ]
    {------------------------------------------------------------------------------}

    procedure ToRange;
    var
      rx, ry: Integer;
    begin
      if not LoggedIn then Exit;
      MakeCompass('N');
      DoomDebug('Going to Range.');
    if (Random(25) <= 12) then
    begin
      Writeln('Used ladder');
      if FindColorSpiralTolerance(rx, ry, FastFindLadderColor, MMX1, MMCY, MMX2, MMY2, 0) then
      begin
        Mouse(rx - 15, ry - 10, 2, 2, True);
        while FlagPresent do
          Randoms;
        WeAreAtRange;
        Exit;
      end;
    end else

    begin
      Writeln('Going outside of door first.');
      if RadialRoadWalk(AutoColorDirtRoad, 235, 208, 49, -2, -2) then
      begin
        Writeln('Used RRW because FirstTime = False');
        while FlagPresent do
          Randoms;
        WeAreAtRange;
        OpenDoor('outside');
        Exit;
      end;
    end;

  2. #2
    Join Date
    Nov 2007
    Location
    The Netherlands
    Posts
    1,490
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What is your error?
    I mean, When i paste it in scar, I get doomdebug error (your function I think ^^), what line is wrong, error, more details please=)

  3. #3
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, DoomDebug is mine, but the error is posted at top of post. I don't get an actual error per say.. Its just a problem with it, but i dont know why or how to fix it..

  4. #4
    Join Date
    Nov 2007
    Location
    The Netherlands
    Posts
    1,490
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Your problem isn't in this procedure/function, since... there isn't even a nextplayer true/false it it
    Go to the top of your script.. ctrl+f and type nextplayer(false); and find the procedure which is wrong

  5. #5
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have already done that.. But the only place i have NextPlayer is towards the end of the script, after set amount of loads is done. (I commented out all the other NextPlayers in order to debug this function..)

    EDIT: And if i use the RadialRoadWalk part of the function it works fine.. Notice how it uses the RRW function more often that the Ladder part? Whenever it uses the RRW part, it works perfectly. However, the first time it goes and uses the Ladder part, it says NextPlayer..

  6. #6
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    FastFindLadderColor, MMX1, MMCY, MMX2, MMY2, 0)

    Its MMY1


  7. #7
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I want it to search only the bottom half of the MM Cazax

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i got it... u forgot Declareplayers or setupsrl, or you did add {.include smart} and you didn't call it or, ask me on msn
    ~Hermen

  9. #9
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by itschris917 View Post
    I want it to search only the bottom half of the MM Cazax
    Then it should be:

    FastFindLadderColor, MMX1, MMY1, MMX2 / 2, MMY2 / 2, 0)


  10. #10
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    The it should be:

    FastFindLadderColor, MMX1, MMY1, MMX2 / 2, MMY2 / 2, 0)
    lets say

    0,0,100,100

    then it will search 0,0,50,50 that will only be the left corner (upper)

    do
    MMX2 / 2, MMY2 / 2, MMX2 , MMY2
    trust me try that
    ~Hermen

  11. #11
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Think about it guys.. MMX1 = the edge of the MM. MMY1 = the top left edge of MM. MMX2 = the right edge of MM. MMY2 = bottom right edge of MM. The first variable is MMX1 cause i want it to search on the left edge of the MM. MMCY is the second cause i want it to start the search at the middle of the MM. MMX2 is the 3rd variable cause i want it to search all the way to the right edge of the MM. MMY2 is the 4th variable cause i want it to search to the bottom of the MM.

  12. #12
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    Then it should be:

    FastFindLadderColor, MMX1, MMY1, MMX2 / 2, MMY2 / 2, 0)
    Rethink that Cazax. If you did want the center point, you would have to average MMX1 and MMX2, MMY1 and MMY2. The minimap doesn't contain the origin, so you can't do MMX2/2, MMY2/2.

    Post the whole script. It's obviously not messing up in what you posted..
    Active only during the Summer...

  13. #13
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Eh, i just made my own autocolor function and it works fine now.. Thanks for the attempts guys

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Im confuzzled...
    By itSchRis917 in forum News and General
    Replies: 6
    Last Post: 05-14-2008, 04:20 AM

Posting Permissions

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