Results 1 to 5 of 5

Thread: R0b0t1's pickaxe finding procedures...

  1. #1
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default R0b0t1's pickaxe finding procedures...

    Erm uh.. Yeah. Tell me how good these work, I've never gotten the time to test them.


    Post something insightful please!

    SCAR Code:
    program New;
    {.Include SRL/SRL.scar}

    Var MPHDTMTol, PHDTMTol, MPHDTMColor, PHDTMColor, PHDTMSize: Integer;
    Var PickHeadMP: TDTMPointDef;
    Var PickHeadSP: Array[0..4] of TDTMPointDef;
    Var PickHeadSkele: TDTM;
    Var r0bPickDTM: Integer;

    Procedure MakePickHeadDDTM;
     begin;
      MPHDTMTol:= 255;
      PHDTMTol:= 5;
      MPHDTMColor:= 3680034;
      PHDTMColor:= 65536;
      PHDTMSize:= 1;

      PickHeadMP.x:= 29;
      PickHeadMP.y:= 16;
      PickHeadMP.AreaSize:= 1;

    \  PickHeadMP.AreaShape:= 0;
      PickHeadMP.Color:= MPHDTMColor;
      PickHeadMP.Tolerance:= MPHDTMTol;

      PickHeadSP[0].x:= 14;
      PickHeadSP[0].y:= 19;
      PickHeadSP[0].AreaSize:= PHDTMSize;
      PickHeadSP[0].AreaShape:= 0;
      PickHeadSP[0].Color:= PHDTMColor;
      PickHeadSP[0].Tolerance:= PHDTMTol;

      PickHeadSP[1].x:= 28;
      PickHeadSP[1].y:= 14;
      PickHeadSP[1].AreaSize:= PHDTMSize;
      PickHeadSP[1].AreaShape:= 0;
      PickHeadSP[1].Color:= PHDTMColor;
      PickHeadSP[1].Tolerance:= PHDTMTol;

      PickHeadSP[2].x:= 31;
      PickHeadSP[2].y:= 14;
      PickHeadSP[2].AreaSize:= PHDTMSize;
      PickHeadSP[2].AreaShape:= 0;
      PickHeadSP[2].Color:= PHDTMColor;
      PickHeadSP[2].Tolerance:= PHDTMTol;

      PickHeadSP[3].x:= 42;
      PickHeadSP[3].y:= 25;
      PickHeadSP[3].AreaSize:= PHDTMSize;
      PickHeadSP[3].AreaShape:= 0;
      PickHeadSP[3].Color:= PHDTMColor;
      PickHeadSP[3].Tolerance:= PHDTMTol;

      PickHeadSP[4].x:= 24;
      PickHeadSP[4].y:= 20;
      PickHeadSP[4].AreaSize:= PHDTMSize;
      PickHeadSP[4].AreaShape:= 0;
      PickHeadSP[4].Color:= PHDTMColor;
      PickHeadSP[4].Tolerance:= PHDTMTol;

      PickHeadSkele.MainPoint:= PickHeadMP;
      PickHeadSkele.SubPoints:= PickHeadSP;
      r0bPickDTM:= AddDTM(PickHeadSkele);
     end;

    Function R0bGetPickColor(Var PickColHolder:Integer; SetDTMNewCol: Boolean): Boolean;
     Var I, XDTM, YDTM: Integer;
     begin;
      If not (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) Then
       begin;
        For I:=0 to 6 do
         begin;
          MakePickHeadDDTM;
          PHDTMSize:= PHDTMSize + 1;
          PHDTMTol:= PHDTMTol + 5;
          If FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2) Then Break;
          If (I = 6) Then
            begin;
              Result:= False;
              Exit;
            end;
         end;
       end;
      PHDTMSize:= 1;
      PHDTMTol:= 10;
      PickColHolder:= GetColor(XDTM, YDTM);
      Result:= True;
      If (SetDTMNewCol) Then
       begin;
        PickHeadMP.Color:= PickColHolder;
        PickHeadMP.Tolerance:= PHDTMTol;
       end;
      If not (Result) Then
       WriteLn('Pick not found');
      FreeDTM(r0bPickDTM);
     end;

    Function R0bFindPickHead(Var r0bPickCol: Integer): Boolean; //Input pick color.
     Var I, B, C, PX, PY, x1, x2, y1, y2:Integer;      //Same as used in above func.
     Var r0bPickHeadColor, r0bPickHandle: Integer;
     Var FoundHead, BreakLoop, Dropped: Boolean;
     begin;
      MakePickHeadDDTM;
      r0bPickHandle:= DTMFromString('78DA63B461606038CE8002C4045918FE03694' +
                     '620FE0F048C0E40C61E0634C0C8C00A5503E6390189FD44A8D94B' +
                                    '408D3990B84A408D2990B8885F0D00A6FC0B62');
      r0bPickHead:= DTMFromString('78DA63CC63606038CA80028C8C5219FE03694' +
                    '620FE0F048C3940C6610634C0C8C00A5503E61503899304D49400' +
                                               '893D04D42412360700DC550BDF');
      For I:=0 to 6 do
       begin;
        PX:= MSCX;
        PY:= MSCY;
         For B:=0 to 6 do
          begin;
           Case B of //Case by WT-Fakawi. I changed the letter :p
             1: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSCx; y2:= MSCy; end;
             2: begin x1:= MSCx; y1 := MSy1 + 20; x2 := MSx2; y2:= MSCy; end;
             3: begin x1:= MSx1; y1 := MSCy;      x2 := MSCx; y2:= MSy2; end;
             4: begin x1:= MSCx; y1 := MSCy;      x2 := MSx2; y2:= MSy2; end;
             5: begin x1:= MSCx - 50; y1 := MSCy - 50; x2 := MSCx + 50; y2:= MSCy + 50; end;
             6: begin x1:= MSx1; y1 := MSy1 + 20; x2 := MSx2; y2:= MSy2; end;
            end;
           For C:=0 to 10 do
            begin;
             BreakLoop:= FindColorSpiralTolerance(PX, PY, r0bPickCol, x1, y1, x2, y2, C);
             If (BreakLoop) Then
              Break;
            end;
           If not (BreakLoop) Then //If it doesn't find the pick color in the part
            Continue;              //of the MainScreen (above case) it goes to the
           If BreakLoop Then       //next loop.
            begin;
             Mouse(PX, PY, 1, 1, False);
             Wait(500+Random(150));
             If (ChooseOption(x, y, 'ake') Then
              begin;
               FFlag(0);
               Wait(3000+Random(500));
               FoundHead:= True;
               Break;
              end else
               begin;
                WriteLn('Did not find ''take'' option');
                Result:= False;
                Exit;
               end;
            end;
           If (FoundHead) Then
             Break;
          end;
        If (FoundHead) Then
         Break;
       end;
       If
       If (FoundHead) Then
        begin;
         WriteLn('Found Head, Attaching...');
         If (WearingItem(5)) Then
          TakeOff(5);
         If not (GameTab(4)) Then
          GameTab(4);
         Wait(300+Random(200));
         If (InvFull) Then
           begin;
            MouseItem(10+Random(5), False);
            Wait(500+Random(200));
            ChooseOption(x, y, 'rop');
            Dropped:= True;
           end;
         end;
         If (FindDTM(r0bPickHandle, PX, PY, MIX1, MIY1, MIX2, MIY2) Then
          begin;
           Mouse(PX, PY, 1, 1, False);
           ChooseOption(x, y, 'se');
           If (FindDTM(r0bPickHead, PX, PY, MIX1, MIY1, MIX2, MIY2)) Then
             Mouse(PX, PY, 2, 2, True);
            end else
             begin;
              WriteLn('Pick head not found in inventory');
              Exit;
             end;
          end else
           begin;
            WriteLn('Pick Handle not found in inventory');
            Exit;
           end;
         If (Dropped) and (EquipPick) Then
          begin;
           If not (FindDTM(r0bPickDTM, PX, PY, MIX1, MIY1, MIX2, MIY2)) Then
            begin;
             WriteLn('Problem locating finished pick');
             Exit;
            end;
           Mouse(PX, PY, 3, 3, True);
           WriteLn('We have attached the head.');
           WriteLn('But we have dropped an item.');
           WriteLn('Sorry. :)');
          end;
        end;
      FreeDTM(r0bPickHandle);
      FreeDTM(r0bPickHead);
      FreeDTM(r0bPickDTM);
     end;


    begin;

    end.

    SCROLL DOWN THROUGH ALL OF IT.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  2. #2
    Join Date
    Dec 2006
    Posts
    723
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function R0bGetPickColor(Var PickColHolder:Integer; SetDTMNewCol: Boolean): Boolean;
     Var I, XDTM, YDTM: Integer;
     begin;
      If not (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) Then
       begin;
        For I:=0 to 6 do
         begin;
          MakePickHeadDDTM;
          PHDTMSize:= PHDTMSize + 1;
          PHDTMTol:= PHDTMTol + 5;
          FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2);
          If (I = 6) Then
           Result:= False;
         end;
       end;

    --->

    SCAR Code:
    Function R0bGetPickColor(Var PickColHolder:Integer; SetDTMNewCol: Boolean): Boolean;
     Var I, XDTM, YDTM: Integer;
     begin;
      If not (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) Then
       begin;
        For I:=0 to 6 do
         begin;
          MakePickHeadDDTM;
          PHDTMSize:= PHDTMSize + 1;
          PHDTMTol:= PHDTMTol + 5;
          if (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) then Break;
          If (I = 6) Then
          begin
            Result:= False;
            Exit;
          end;
         end;
       end;

    If it doesn't exit it will always result true. Read your function again.

  3. #3
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Hmm? Oh. Thats the one thing I missed, I guess.


    EDIT: Thanks town, I updated it.
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  4. #4
    Join Date
    Dec 2006
    Posts
    723
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I also put in if (FindDTM(r0bPickDTM, XDTM, YDTM, MIX1, MIY1, MIX2, MIY2)) then Break; which you missed. If it doesn't do that then it will continue in that loop until it gets to 6, and then exit even though it found the DTM. Sorry I didn't point out that I had change that.

  5. #5
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    Ah, yes, thanks you... I am unobservant today .


    Are those the only mistakes? If they are, I'm amazed...
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pickaxe Undetectable
    By codyflare in forum News and General
    Replies: 2
    Last Post: 05-22-2008, 12:13 AM
  2. Pickaxe head anti random
    By ~alex~ in forum OSR Help
    Replies: 7
    Last Post: 04-12-2007, 03:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •