Results 1 to 12 of 12

Thread: RockFinding Using TPA..error

  1. #1
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    RockFinding Using TPA..error

    I need help with my TPA, is everything ok in here? Well, it keeps clicking random places(not the rock) anyone know why??
    Thanks.
    here is the part of the script that messes up

    SCAR Code:
    function FindOres:boolean;
    var
      tx,ty,i: integer;
      IronPoints: TPointArray;
      Iron2D : T2DPointArray;
      IronPoint : TPoint;
    begin
      if not LoggedIn then exit;
      x:= MSCX;
      y:= MSCY;
      if (Players[CurrentPlayer].Strings[1] = 'both') then
      begin
        FindColorsSpiralTolerance(x,y,IronPoints,2898527,MSX1,MSY1,MSX2,MSY2,1);
        Iron2D:= TPAtoATPAEx(IronPoints,30,30);
        for i:= 0 to length(Iron2D)-1 do
        begin
          if not LoggedIn then exit;
          Ironpoint:= MiddleTPA(Iron2D[i]);
          tx:= IronPoint.X;
          ty:= IronPoint.Y;
          MMouse(tx,ty,2,2);
          wait(90+random(50));
          if isuptext('ine')then
          begin
            GetMousePos(tx,ty);
            result:= true;
          end;
        end;
      end;
    end;

  2. #2
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I realy don't know what your doing, you first should learn more about tpa's....
    take a look at my tpa iron finder:

    SCAR Code:
    Function FindIron(var xr, yr: Integer): Boolean; // BY MASTERKILL
    Var
      RealIron, IronRock: Array Of TPoint;
      CurPoint: TPoint;
      TolSpeed, MK, xx, yy: Integer;
    Begin
      TolSpeed := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(x, y, RealIron, 2832989, MSX1, MSY1, MSX2, MSY2, 6); // looking for iron colors
      For MK := 0 To High(RealIron) Do
      Begin
        CurPoint := RealIron[MK];
        FindColorsTolerance(IronRock, 1659234, CurPoint.X - 15, CurPoint.Y - 15, CurPoint.X + 15, CurPoint.Y + 15, 20); // looking for rock colors around the iron color
        If (High(IronRock) > 15) Then // if find enough rock then
        Begin
          MiddleTPAEx(IronRock, xx, yy);
          MMouse(xx, yy, 0, 0);
          If FindColorTolerance(x, y, 2832989, xx - 15, yy - 15, xx + 15, yy + 15, 6) Then // if still iron in the rock
          Begin
            Wait(100 + Random(100));
            If (Pos('ine', rs_getuptext) <> 0) Then // super fast uptext finding
            Begin
              xr := xx; yr := yy; // resulting the result of the rock coords
              Result := True;
              Exit;
            End;
          End;
        End;
      End;
      ColorToleranceSpeed(TolSpeed);
    End;

    Procedure MineIron;
    Begin
      If FindIron(Xvar, Yvar) Then Mouse(Xvar, Yvar, 0, 0, True);
    End;

  3. #3
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    rawrr thanks MK, hehe I blame Iron Man, I'll try my way of making tpa

    EDIT: I EDITED THE TPA PLEASE CHECK!!!!!!!!!!!!!!!!
    THere is a problem, it keeps just clicking on the groudn and not a rock PLEASE HELP!

    SCAR Code:
    function FindOres:boolean;
    var
      tx,ty,i: integer;
      IronPoints: TPointArray;
      Iron2D : T2DPointArray;
      IronPoint : TPoint;
    begin
      if not LoggedIn then exit;
      x:= MSCX;
      y:= MSCY;
      if (Players[CurrentPlayer].Strings[1] = 'both') then
      begin
        FindColorsSpiralTolerance(x,y,IronPoints,2898527,MSX1,MSY1,MSX2,MSY2,1);
        Iron2D:= TPAtoATPAEx(IronPoints,30,30);
        for i:= 0 to length(Iron2D)-1 do
        begin
          if not LoggedIn then
          begin
            break;
          end;
          Ironpoint:= MiddleTPA(Iron2D[i]);
          tx:= IronPoint.X;
          ty:= IronPoint.Y;
          MMouse(tx,ty,2,2);
          wait(90+random(50));
          if isuptext('ine')then
          begin
            GetMousePos(x,y);
            result:= true;
            break;
            exit;
          end;
        end;
      end;
    end;

    procedure MinedaRock;
    var
      i, MiningTime : Integer;
      Blacktext : string;
    begin
      MakeCompass('N');
      SetAngle(True);
      for i := 0 to 2 do
      repeat
        if Not(LoggedIn) then exit;
        writeln('start');
        Myrandom;
        if FindOres then
        writeln('brap');
        Mouse(x,y,2,2,True);
        MarkTime(MiningTime);
        repeat
          BlackText := GetBlackChatMessage;
          if (getcolor(486, 384) = 0) then
          Wait(250+Random(300));
        until (Pos('anage', BlackText) <> 0) or (Pos('vailable', BlackText) <> 0) or (TimeFromMark(MiningTime) > (WaitperRock +random(250)));
      until (InvFull);
      if (InvFull) then
      begin
        writeln( 'Inventory Full walking to bank.' );
      end;
    end;

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Well i've not yet mastered TPA's .
    But some feedback.
    SCAR Code:
    if FindOres then
        writeln('brap');
        Mouse(x,y,2,2,True);

    No need for that as you already call GetMousePos in the FindOres
    procedure.

    And:

    SCAR Code:
    GetMousePos(x,y);
      result:= true;
      break;
      exit;



    Why need the Break and the Exit?

    Also:

    The reason why your going wrong is your co-ords aren't right there meant to be tx,ty not x,y

    So it sorted :=
    SCAR Code:
    function FindOres:boolean;
    var
      tx,ty,i: integer;
      IronPoints: TPointArray;
      Iron2D : T2DPointArray;
      IronPoint : TPoint;
    begin
      if not LoggedIn then exit;
      x:= MSCX;
      y:= MSCY;
      if (Players[CurrentPlayer].Strings[1] = 'both') then
      begin
        FindColorsSpiralTolerance(x,y,IronPoints,2898527,MSX1,MSY1,MSX2,MSY2,1);
        Iron2D:= TPAtoATPAEx(IronPoints,30,30);
        for i:= 0 to length(Iron2D)-1 do
        begin
          if not LoggedIn then
          begin
            break; // No need for this??!!
          end;
          Ironpoint:= MiddleTPA(Iron2D[i]);
          tx:= IronPoint.X;
          ty:= IronPoint.Y;
          MMouse(tx,ty,2,2);
          wait(90+random(50));
          if isuptext('ine')then
          begin
            GetMousePos(tx,ty);
            result:= true;
            exit;
          end;
        end;
      end;
    end;
     
    procedure MinedaRock;
    var
      i, MiningTime : Integer;
      Blacktext : string;
    begin
      MakeCompass('N');
      SetAngle(True);
      for i := 0 to 2 do // Why you need this???
      repeat
        if Not(LoggedIn) then exit;
        writeln('start');
        Myrandom;
        if FindOres then
        writeln('brap');
        MarkTime(MiningTime);
        repeat
          BlackText := GetBlackChatMessage;
          if (getcolor(486, 384) = 0) then
          Wait(250+Random(300));
        until (Pos('anage', BlackText) <> 0) or (Pos('vailable', BlackText) <> 0) or (TimeFromMark(MiningTime) > (WaitperRock +random(250)));
      until (InvFull);
      if (InvFull) then
      begin
        writeln( 'Inventory Full walking to bank.' );
      end;
    end;

    Have fun, Good Luck

  5. #5
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Wel even if I have GetMousePos wouldn't I still need Mouse(x,y,2,2,True) because ....I dont think GetMousePos clicks the ore does it? If not, wouldn't I need a line for clicking the ore like "Mouse(x,y,2,2,True)" ?

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

    Default

    MasterKill, are you out of your mind?!

    Let's say there are four iron rocks on the screen, one iron vein is let's say 100 pixels, so, 400 iron pixels, and you do a freaking FindColorsTolerance around them until you find a rock? You are supposed to do a FindColorsSpiralTolerance for the iron color, and one for the dirt color and then do either a RAaSTPA or a TPAToATPA, or maybe even a SplitTPA if you have very accurate colors and small tolerances, or atleast do a MiddleTPA to each of our four iron veins and do the mud searches around them, but no damn 400 FindColorsTolerances.

    Now, go tell your mommy what you learned today

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    *N3ss3s defends his/her title*

  8. #8
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Wel even if I have GetMousePos wouldn't I still need Mouse(x,y,2,2,True) because ....I dont think GetMousePos clicks the ore does it? If not, wouldn't I need a line for clicking the ore like "Mouse(x,y,2,2,True)" ?---LOL lets stop flaming and please answer this question.. I want to release my new version today.. Please EVERYONE try Your BEST to help As much as possible ...THANKS>.ALL REP!

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

    Default

    Here is the fix:
    SCAR Code:
    function FindOres:boolean;
    var
      tx,ty,i: integer;
      IronPoints: TPointArray;
      Iron2D : T2DPointArray;
      IronPoint : TPoint;
    begin
      if not LoggedIn then exit;
      x:= MSCX;
      y:= MSCY;
      if (Players[CurrentPlayer].Strings[1] = 'both') then
      begin
        FindColorsSpiralTolerance(x,y,IronPoints,2898527,MSX1,MSY1,MSX2,MSY2,1);
        Iron2D:= TPAtoATPAEx(IronPoints,3,3);
        for i:= 0 to length(Iron2D)-1 do
        begin
          if not LoggedIn then exit;
          Ironpoint:= MiddleTPA(Iron2D[i]);
          tx:= IronPoint.X;
          ty:= IronPoint.Y;
          MMouse(tx,ty,2,2);
          wait(90+random(50));
          if isuptext('ine')then
          begin
            GetMousePos(tx,ty);
            result:= true;
          end else Continue;
        end;
      end;
    end;
    Test it...


  10. #10
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    sory, but nope still same problem randomly clicking on floor...ugg..strting to hate this..

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

    Default

    This thread is filled with the weirdest TPA code I've ever seen...

    Two main ways of the finding, may be a little different for different scripters but the idea remains same:

    SCAR Code:
    Function FindAllRocks(Color, Tol: Integer): TPointArray;

    Var
       CTS: Integer;
    Begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, Result, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      ColorToleranceSpeed(CTS);
      RAaSTPAEx(Result, 22, 22);
    End;


    Function FindAllRocks2(Color, Tol, MinPix: Integer): TPointArray;

    Var
       X, Y, Z, CTS, S: Integer;
       TPAA: TPointArray;
       TPA: TPointArray;
    Begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      ColorToleranceSpeed(CTS);
      TPAA := TPAToATPAEx(TPA);
      SetArrayLength(Result, GetArrayLength(TPAA));
      For z := 0 To High(TPAA) Do
        If GetArrayLength(TPAA[z]) >= MinPix Then
        Begin
          Result[s] := MiddleTPA(TPAA[z]);
          s := s + 1;
        End;
      SetArrayLength(TPAA, S);
    End;


    and then, the finding of a good one


    SCAR Code:
    Function FindRock(Var X, Y: Integer; Color, Tol: Integer): Boolean;

    Var
       TPA: TPointArray;
       I: Integer;
    Begin
      TPA := FindAllRocks2(Color, Tol, 5);
      // Or TPA := FindAllRocks(Color, Tol);
      For I := 0 To High(TPA) Do
        If Not w_GasCheck(TPA[i].x, TPA[i].y) Then
        Begin
          MMouse(TPA[i].x, TPA[i].y, 3, 3);
          If IsUpText('ine') Then
          Begin
            GetMousePos(X, Y);
            Result := True;
            Break;
          End;
        End;
    End;

  12. #12
    Join Date
    Mar 2007
    Posts
    1,223
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    its weird? wel I've fixed the one I have and it works perfectly
    but thanks anyways

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 02-26-2008, 04:14 PM
  2. Smart error and Some kind of Math.scar error
    By FagetHax0r in forum OSR Help
    Replies: 6
    Last Post: 02-24-2008, 10:43 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
  •