Results 1 to 3 of 3

Thread: Priority Mining.

  1. #1
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default Priority Mining.

    I've got this mining function
    Simba Code:
    Function MineRock(WutRock:Integer):Boolean;
    var I,PlusOne,tMine,J:Integer;
        OrePts, RockPts, Bingo:TPointArray;
        OrePtsBox, RockPtsBox, BingoBox: T2DPointArray;
        OrePt, BingoPt: TPoint;
        HighRock:Integer;
        SearchBox: TBox;
    Begin
      If Not(LoggedIn) Then Exit;
      StatsGuise('Searching For Rock: '+ IntToStr(InvCount));
      If OreInLast Then Exit;

      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.02, 0.09);
      FindColorsSpiralTolerance(MSCX, MSCY, RockPts, 3565690, MSX1, MSY1, MSX2, MSY2, 12);
      SetColorSpeed2Modifiers(0.2,0.2);
      ColorToleranceSpeed(1);

      RockPtsBox:=TPAtoATPAEx(RockPts,35,35);
      {DebugATPABounds(RockPtsBox);
      Writeln('This is RockPtsBox');}



      //Writeln('RockPts ' + IntToStr (GetArrayLength(RockPts) ) );

      For I:=0 To High(RockPtsBox) Do
      Begin
        If Not(LoggedIn) Then Break;
        //Writeln('Searching Box ' +IntToStr (i));
        SearchBox:= GetTPABounds(RockPtsBox[i]);
        //Writeln( IntToStr(SearchBox.x1) + ',' + IntToStr(SearchBox.y1)+ ',' + IntToStr(SearchBox.x2)+ ',' + IntToStr(SearchBox.y2) );
        If (GetArrayLength(RockPtsBox[I]) > 30) Then
        Begin
          If YDebug Then DebugATPA(RockPtsBox,'');
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(0.07,1.06);
          FindColorsSpiralTolerance(MSCX,MSCY,OrePts,3358822,SearchBox.x1,SearchBox.y1,SearchBox.x2,SearchBox.y2,6);
          Writeln('OrePts ' + IntToStr (GetArrayLength(OrePts) ) );
          SetColorSpeed2Modifiers(0.2,0.2);
          ColorToleranceSpeed(1);
          If High(OrePts) > 1 Then
          Begin
            BingoBox:=TPAtoATPAEx(OrePts, 1, 1);
            {DebugTPA(OrePts,'');
            Writeln('This is BingoBox'); }

            If GetArrayLength(BingoBox[i])<1 Then Continue;
            BingoPt:= MiddleTPA(BingoBox[I]);
            If CheckAndClick('ine',BingoPt.x,BingoPt.y) Then
            Begin
              Result:=True;
              MarkTime(tMine);
              StatsGuise('Mining Rock: '+ IntToStr(InvCount));
              Players[CurrentPlayer].Loc:='Mining';
              PlusOne:=InvCount+1;
              Repeat
                If Not(LoggedIn) Then Break;
                Wait(200);
                If Random(2) = 0 Then
                Begin
                  RT:=GetSystemTime;
                  If FindNormalRandoms Then
                    IncEx(WeMined,GetSystemTime - RT);
                End;
                If Random(50)=1 Then SleepAndMoveMouse(500+Random(100));
                //If (Not(IsMoving)) Then Begin Writeln('a'); Break; End;
                If InvCount=PlusOne Then
                Begin
                  Inc(J);
                  TOres:=TOres + J;
                  Inc(Players[CurrentPlayer].Integers[81]);
                End;
              Until (InvCount = PlusOne)  Or (TimeFromMark(tMine) > ((Players[CurrentPlayer].Integers[2]*1000) + Random(500)));
              Exit;
            End;
          End Else Continue;
        End;
      Wait(750+Random(250));
      End;
    End;

    Currently it just mines Iron ores.

    How could I add 'priority mining' to this so it could mine Adamant, Mithril, Coal, and Iron, search for the higher value ores first and then moving onto the other ones.

    As you can I see all I need to change is the CTS into (colors, told,s hue, sat, whatever) in order to make this mine different things, just want it to check for multiple ores and prioritize some over others.

    Thanks.
    Ask for any code explanation if you need it.

  2. #2
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Take a look at how MSI does it?

    Basically, we have an objects array that stores all the rocks a player wants to mine. And another array (same length as the rocks array) with numbers to match each rock. The higher the number, the more likely it is to search for that rock first.

    All the functions you're looking for are in MSI's Manipulation.simba. You'll want to call RearrageArray before you call your rock finding method.

  3. #3
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Store each ore as an integer, best ore being 0 worst being 10 (?)
    In your mining function loop through to see which best ore is available and store it. Then mine it.

    -Boom

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
  •