Results 1 to 7 of 7

Thread: TPA trouble

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

    Default TPA trouble

    hey ok i just dont understand what im doing wrong, please help

    Code:
    function CutYew: Boolean;
    var
       x, y: integer;
       Color: TpointArray;
       i : integer;
    
    begin
      if(InFight or InvFull) then Exit;
      Result := False;
      Color[i] := [4820866, 2648669, 3240805, 4359803, 4424052, 2385497, 1325361, 1124644, 2381903, 665632, 2977122];
      for i := 0 to 10 do
      begin
        if not FindObjTPA(x, y, Color[i], 7, -1, 30, 30, 4, ['ew', 'Yew']) then Exit;
        if FindObjTPA(x, y, Color[i], 7, -1, 30, 30, 4, ['ew', 'Yew']) then
        begin
          SWait;
          MMouse(x, y, 3, 3);
          if IsUpText('ew') then
          begin
            Mouse(x, y, 4, 4, True);
            Result := true;
          end;
          if(Result) then Exit;
        end;
      end;
    end;
    btw i was told this is the best way to chop yews, is that true?
    Last edited by Lance; 03-24-2009 at 08:49 AM.
    Lance. Da. Pants.

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Using SCAR Assistant and the data from your function, I created this function for you:

    SCAR Code:
    program SCARAssistant;
    {.include SRL/SRL.scar}
     
    function FindObject: Boolean;
    var
      Colors: TIntegerArray;
      X, Y, I, A, M, curCTS: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
     
    begin
      Result := False;
      if not LoggedIn then exit;
      curCTS := GetColorToleranceSpeed;
      Colors := [4820866, 2648669, 3240805, 4359803, 4424052, 2385497, 1325361, 1124644, 2381903, 665632, 665632, 2977122];
      for I := 0 to 11 do
      begin
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[I], MSX1, MSY1, MSX2, MSY2, 7);
        if Length(TPA) = 0 then Continue;
        ColorToleranceSpeed(1);
        ATPA := TPAtoATPAEx(TPA, 30, 30);
        M := High(ATPA);
        for A := 0 to M do
          if MiddleTPAEx(ATPA[A], X, Y) then
          begin
            MMouse(X, Y, 6, 6);
            Wait(100 + Random(50));
            if Pos('Yew', RS_GetUpText) > 0 then
            begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0, 0, True);
              Result := True;
              ColorToleranceSpeed(curCTS);
              Exit;
            end;
          end;
      end;
      ColorToleranceSpeed(curCTS);
    end;
     
    begin
      SetUpSRL;
      ActivateClient;
      Wait(350 + Random(500));
      FindObject;
    end.

    Try to see if you can single out differences between your function and this.

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

    Default

    When you want someone else to tell you what are you doing wrong you should tell what is not working...

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

    Default

    TPointArray <> TIntegerArray (var Color)
    SCAR Code:
    if not FindObjTPA(x, y, Color[i], 7, -1, 30, 30, 4, ['ew', 'Yew']) then Exit;
        if FindObjTPA(x, y, Color[i], 7, -1, 30, 30, 4, ['ew', 'Yew']) then
    Else

    You might want to read my tutorial(sig) for detailed explanation on TPA's...


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

    Default

    sorry, i get the errror: Type mismatch in script
    Lance. Da. Pants.

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

    Default

    As I said, a TPointArray is an array of TPoint, not an array of Integer(colors in this case). That's why you are getting a type mismatch error.


  7. #7
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by lancerawks View Post
    sorry, i get the errror: Type mismatch in script
    WHat CAzax says: Change

    Var
    Colors: TPointArray

    to

    var
    Colors : TIntegerArray;
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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
  •