Results 1 to 8 of 8

Thread: Mining Help

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Mining Help

    Ok so here is my problem:

    For my powerminer, more specifically my manscreen mining, after ore has been dropped it is the same color as the rock veins. Now, My script seems to mouse over this, not alot but its still annoying. To combat this I tried getting the mouse position everytime that the script doesnt find the correct uptext. This fixes the multiple mousing over, but it still has to mouse over the area to get the point to now mouse over anymore. So my Question is, How would I combat this, My idea would be checking pixel lengths (rock veins are smaller than the ore on the ground) but I dont really know where to start.

    Code:

    SCAR Code:
    Function AllocateRockPoints(index: Integer): TpointArray;
    var tpa: TpointArray; atpa: T2DPointArray; l, i, c, cts, col: Integer;
    begin
      c := currentPlayer;
      i := random(Length(rock[c][index].col));
      col := rock[c][index].col[i];
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(rock[c][index].hue, rock[c][index].sat);
      FindColorsSpiralTolerance(MScx, MScy, tpa, col, MSx1, MSy1, MSx2, MSy2, rock[c][index].lum);
      SortTpaFrom(tpa, Point(MScx, MScy));
      Atpa := TpatoAtpaEx(Tpa, 10, 10);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 5 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      ColorToleranceSpeed(cts);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if (l > 0) then WriteLn('Found: '+IntToStr(l)+' Point(s)');
    end;

    Function C_MSpoint(tpa: TpointArray; Index: Integer): Boolean;
    var i, x, y: integer; Bool: Boolean;
    begin
      for i := 0 to High(tpa) do
      begin
        WriteLn('Current Point at: ('+IntToStr(Tpa[i].x)+', '+IntToStr(tpa[i].y)+');');
        if InRange(Tpa[i].x, Rock[CurrentPlayer][index].x-10, Rock[CurrentPlayer][index].x+10) or
          InRange(tpa[i].y, Rock[CurrentPlayer][index].y-10, Rock[CurrentPlayer][index].y+10) then Continue;
        MMouse(tpa[i].x, tpa[i].y, 2, 2);
        Wait(350+random(200));
        If IsUpTextMultiCustom(['ine','ock']) then
        begin
          GetMousePos(x, y);
          Wait(Random(500));
          bool := random(4) <> 1;
          Mouse(x, y, 0, 0, Bool);
          Result := True;
          Wait(200+random(150));
          ChooseOption('ine');
          Exit;
        end else
        begin
          GetMousePos(Rock[CurrentPlayer][index].x, Rock[CurrentPlayer][index].y);
          Continue;
        end;
      end;
    end;

    Function Loop(Index: Integer): Boolean;
    var Tpa: TpointArray; i, a: Integer;
    begin
      case Index of
        0: // Mining Loop
        begin
          i := Players[CurrentPlayer].Integers[0];
          tpa := AllocateRockPoints(i);;
          if Length(tpa) > 0 then
            if C_MSpoint(tpa, i) then
          a := getsystemtime;
          if TextCheck <> 1 then
            while TextCheck <> 1 do
          begin
            Wait(150);
            if Getsystemtime-a > RandomRange(2750, 3500) then Break;
          end;
          while IsMining do
          begin
            FindNormalRandoms;
            Result := True;
          end;
        end;
        1: DropItems(DropArr);
      end;
    end;

    more of the script can be supplied if requested. Any help is appreciated, thanks in advance.
    “Ignorance, the root and the stem of every evil.”

  2. #2
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Silly JaGeX, my idea would be to ignore a small box just below MSCX. Or have multiple colours in the rock finding. Have you tried changing to ATPA size?

    SCAR Code:
    Atpa := TpatoAtpaEx(Tpa, 10, 10);

    If its just a small vein you want, that may be a little be too large, perhaps have it something like 10, 2?

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Try using SplitTPAEx(tpa, 4, 4);

    Also, sorting your ATPA.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Try using SplitTPAEx(tpa, 4, 4);

    Also, sorting your ATPA.
    wouldnt split tpa just split the areas up, which doesnt really solve my problem does it? the ore would still get grouped and split the same (well not the same, but the same effect I guess Is what I'm saying).

    And I'm not sure what you mean by sorting the ATPA, I sort the TPA before I make it a T2DpointArray, isn't that good enough (or am i missing something).
    “Ignorance, the root and the stem of every evil.”

  5. #5
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    I'd suggest using SplitTPA (not SplitTPAEx) and then GetTPABounds, as an ore on the floor will have much smaller bounds.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  6. #6
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    I'd suggest using SplitTPA (not SplitTPAEx) and then GetTPABounds, as an ore on the floor will have much smaller bounds.

    ~RM
    thank you, I will give this a go (I might get you to review the code after I'm done with it to see if I did it correctly, if your o.k with that).

    edit: did not work. I had to adjust the length of the tpa to the point where it would only find one or two of the rocks (out of 5) to not mouse over the dropped ores.
    “Ignorance, the root and the stem of every evil.”

  7. #7
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  8. #8
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    thank you, I will give this a go (I might get you to review the code after I'm done with it to see if I did it correctly, if your o.k with that).

    edit: did not work. I had to adjust the length of the tpa to the point where it would only find one or two of the rocks (out of 5) to not mouse over the dropped ores.
    I said TPABounds, not length

    SCAR Code:
    ATPA := SplitTPA(TPA, 5);
      for i := 0 to High(ATPA) do
      begin
        TB := GetTPABounds(ATPA[i]);
        TIA[i] := (TB.x2 - TBx1) * (TB.y2 - TB.y1);
      end;

    that'll give you the bounds of each TPA. The smallest bounds would be ores.
    Now just find a way to sort your TPA according to the TIA

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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
  •