Results 1 to 12 of 12

Thread: FindColorsSpiralTolerance Help :S

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Question FindColorsSpiralTolerance Help :S

    hey so im makeing a TPA to kill goblens.. i couldnt seem to get it to work so i looked up a TPA / ATPA tutorial and i did learn some useful things ;D but my function still isnt working =/

    SCAR Code:
    function Attack : Boolean;
    var
      x, y, i, H, count : Integer;
      Color : TIntegerArray;
      TPA : TPointArray;
      ATPA : T2DPointArray;
     
    begin
      Color := [3908509, 4417328, 3842202, 5867839];
      x := MSCX;
      y := MSCY;
      for i := 0 to High(Color) do
      begin
        Writeln('Test');
        if FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSX2, MSX2, MSY2, 7) then
        begin
          Writeln('FOUND MONSTER');
          ATPA := TPAtoATPA(TPA, 15);
          if Length(ATPA) > 0 then
          begin
            H := High(ATPA);
            for i := 0 to H do
            begin
              MiddleTPAEx(ATPA[i], x, y);
              MMouse(x, y, 2, 2);
              Wait(10+Random(20));
              if IsUpText('oblin') then
              begin
                GetMousePos(x, y);
                if MouseCross(x, y, 0, 0, true) then
                begin
                  Status('Fighting');
                  Wait(1000+Random(500)+RanInt(100));
                end;
              end;
            end;
          end;
        end;
      end;
    end;

    when it rolls over the Attack function in the mainloop, it does write 'Test' in the debug.. and then the function exits. so from that ive concludedd that im not useing FindColorsSpiralTolerance correctly.. but i dont see what im doing wrong =/ could anyone show me how to properly use it?
    Last edited by Lance; 05-28-2009 at 07:02 AM.
    Lance. Da. Pants.

  2. #2
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    try this
    SCAR Code:
    function Attack : Boolean;
    var
      x, y, i, H, count : Integer;
      Color : TIntegerArray;
      TPA : TPointArray;
      ATPA : T2DPointArray;
     
    begin
      Color := [3908509, 4417328, 3842202, 5867839];
      x := MSCX;
      y := MSCY;
      for i := 0 to High(Color) do
      begin
        Writeln('Test');
        if FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 7) then
        begin
          Writeln('FOUND MONSTER');
          ATPA := TPAtoATPA(TPA, 15);
          if Length(ATPA) > 0 then
          begin
            H := High(ATPA);
            for i := 0 to H do
            begin
              MiddleTPAEx(ATPA[i], x, y);
              MMouse(x, y, 2, 2);
              Wait(10+Random(20));
              if IsUpText('oblin') then
              begin
                GetMousePos(x, y);
                if MouseCross(x, y, 0, 0, true) then
                begin
                  Status('Fighting');
                  Wait(1000+Random(500)+RanInt(100));
                end;
              end;
            end;
          end;
        end;
      end;
    end;


    ~shut

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    i dunno, it looks about right. im just guessing but maby its the color array you use?

    that or its simply not finding the color
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    its not the colors, they are deffinatley there. and ive always had a problem with this function =/ its so useful though.

    OH i just realized i put
    FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSX2, MSX2, MSY2, 7)
    not
    FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 7)

    i changed it.. but its still not working =/ haha shut it sucks i have to copy / paste each line into scar cause if i do it all at once it just pastes as one line of code =S but im doing that now
    Last edited by Lance; 05-28-2009 at 06:37 AM.
    Lance. Da. Pants.

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

    Default

    scar Code:
    if FindColorsSpiralTolerance(x, y, TPA, Color[i], MSX1, MSX2, MSX2, MSY2, 7) then
    to:
    scar Code:
    if FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 7) then


  6. #6
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  7. #7
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    no it dosnt =S i asume that you just changed that one mistake i had found around right? i couldt find you changing anything else. hmm ill just post my entire script up in the first post. thanks for helping guys :]
    Lance. Da. Pants.

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

    Default

    You didn't look very well at my change:
    x -> MSCX
    y -> MSCY
    EDIT: Didn't see that you declared those at the start.
    MSX2(FATAL ERROR) -> MSY1
    Last edited by Cazax; 05-28-2009 at 07:13 AM.


  9. #9
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    You didn't look very well at my change:
    x -> MSCX
    y -> MSCY
    MSX2(FATAL ERROR) -> MSY1

    i set:
    x := MSCX;
    y := MSCY;
    before the surching.. isnt that the same thing? ill try what you said anyway.

    Edit: nope..
    SCAR Code:
    FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 7)
    still dosnt work =/
    Lance. Da. Pants.

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

    Default

    Now I found an error, you are using I for two loops and one if them is inside of another loop, that makes I to change its original value. Use another variable to loop the ATPA.


  11. #11
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    Now I found an error, you are using I for two loops and one if them is inside of another loop, that makes I to change its original value. Use another variable to loop the ATPA.
    oh k, i never thougth of that, but i suppose that makes sence. i changed the second i to j, but stilll its not working =/ did you guys download my file and try runnig it to see if it works? =o maby just change the color or something.. i realy dont understand this -.-
    Lance. Da. Pants.

  12. #12
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh oh oh found it. i think its working now. thanks for everything guys =D
    Lance. Da. Pants.

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
  •