All pastes #246084 Raw Edit

Someone

public text v1 · immutable
#246084 ·published 2006-11-11 21:11 UTC
rendered paste body
{=========================================================================]
[                          SRL Guildminer 0.39.                           ]
[                                                                         ]
[              NAME        : SRL Guildminer 0.39                          ]
[              WRITER      :  by Wizzup and WT-Fakawi (by Stupid3ooo)     ]
[              CATEGORY    : Miner                                        ]
[              DESCRIPTION : See below.                                   ]
[              USAGE       : Miner/banker for coal                        ]
[              AUTOCOLOR   : YES                                          ]
[              SRL REV.    : SRL Version 3.                               ]
[              NOTES       : STAND @ LEFTMOST BANKSLOT                    ]
[                            FACE MM PERFECT NORTH.                       ]
[=========================================================================]
| Description:                                                            |
|   A macro that mines a full load of coal and mith in the miner's guild, |
|   then banks it in the east Falador bank.                               |                            |
| Instructions:                                                           |
|   1.Set the Runescape brightness to V-bright, and your computer's       |
|     resolution to 32bit resolution.                                     |
|   2.Need SCAR version 2.0.3.                                            |
|   3.Start script in the Falador eastern bank.                           |
|   4.Start with a pickaxe in your fist inventory slot or equiped.        |
|   5.Recomended to have extra pickaxes in your first bank slot.          |
|   6.Click and drag the crosshair over the Runescape client.             |
      Then press the green arrow.                                         |
|   7.START @ FALADOR EASTBANK LEFTMOST BANKSLOT FACE MM PERFECTLY NORTH  |
[=========================================================================}


program SRLGuildMiner;

{.include SRL/SRL.scar}
{.include SRL/SRL/skill/Mining.scar}
{.include SRL/SRL/misc/FaladorColorFinder.scar}
{.include SRL/SRL/extended/xMapWalk.scar}

Const
  Loads                = 2;     // Number of loads before switching user.
  OreTol               = 4;
  StartPlayer          = 0;

Const
  CoalColor              = 2438711;   // CoalColor is a constant
  MithrilColor           = 7425100;   // MithrilColor is a constant

//----------------------------------------------------------------------------//
Const VersionNumber        = '0.39';
//----------------------------------------------------------------------------//

Var MapPickColor,MapOreColor,LadderColor,
    TotalOres,SecondsToWait,H,G:integer;

Var FB1,FB2,FB3: Integer; // BankerDTMs (Yellow dots at three angles: -10,0,+10 degrees)
// For use with DTM3Flag that plants a flag when any of 3 DTM's is found


//----------------------------------------------------------------------------//

Procedure DeclarePlayers;
begin
     HowManyPlayers:=6;
     NumberOfPlayers(HowManyPlayers);
     Players[0].Name     :='';
     Players[0].Pass     :='';
     Players[0].Nick     :='';
     Players[0].Loc      :='Falador';
     Players[0].Boolean1 := True;   // EquipPick.
     Players[0].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[0].Active   := True;

     Players[1].Name     :='';
     Players[1].Pass     :='';
     Players[1].Nick     :='';
     Players[1].Loc      :='Falador';
     Players[1].Boolean1 := True;   // EquipPick.
     Players[1].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[1].Active   := True;

     Players[2].Name     :='';
     Players[2].Pass     :='';
     Players[2].Nick     :='';
     Players[2].Loc      :='Falador';
     Players[2].Boolean1 := True;   // EquipPick.
     Players[2].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[2].Active   := True;

     Players[3].Name     :='';
     Players[3].Pass     :='';
     Players[3].Nick     :='';
     Players[3].Loc      :='Falador';
     Players[3].Boolean1 := True;   // EquipPick.
     Players[3].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[3].Active   := True;

     Players[4].Name     :='';
     Players[4].Pass     :='';
     Players[4].Nick     :='';
     Players[4].Loc      :='Falador';
     Players[4].Boolean1 := True;   // EquipPick.
     Players[4].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[4].Active   := True;

     Players[5].Name     :='';
     Players[5].Pass     :='';
     Players[5].Nick     :='';
     Players[5].Loc      :='Falador';
     Players[5].Boolean1 := True;   // EquipPick.
     Players[5].String1  := 'Coal'; // Coal = coal only. Mithril = both.
     Players[5].Active   := True;

end;

//----------------------------------------------------------------------------//

Procedure FillMem;   // 3 yellow dot bankers @ different angle
begin

  FB1 := DTMFromString('78DA636C66626008634001972E5E66F80FA41' +
       '981F83F1030B601D5C4A0AAF9F38789810BAA0604189B8850D345' +
       '580D00CA7B110D');
  FB2 := DTMFromString('78DA63EC61626008614001478F1E65F80FA41' +
       '981F83F1030F602D544A1AAF9F38789810BAA0604182712A1662A' +
       '504D247E3500C2961107');
  FB3 := DTMFromString('78DA636C646260086140038C0CFFC12403C37' +
       'F206004A9894255F1E70F130317540D58472B504D3401359D4035' +
       '31F8D50000978B0E8E');
end;

//----------------------------------------------------------------------------//

Procedure SetOres;

Begin
  Case Lowercase(Players[CurrentPlayer].String1) Of
    'coal'   : Begin OreColor1 := CoalColor OreColor2 := OreColor1 End;
    'mithril': Begin OreColor1 := MithrilColor ; OreColor2 :=CoalColor ; End;
  End;
End;

//----------------------------------------------------------------------------//

Function FindOre(MaxTol:Integer):Boolean;

Var Tol,Ex,Ey:Integer;

Begin

H:=H+1;
  For G := 1 to H do
   Begin
    Case G Of

      1: Begin OreColor:= OreColor1; SecondsToWait := 5; End;
      2: Begin OreColor:= OreColor2; SecondsToWait := 10; End;

    End;
   End;

  While (Not (FindColorTolerance(Ex, Ey, OreColor, MSX1, MSY1, MSX2, MSY2, Tol))
  And Not (Tol > MaxTol)) Do
    Begin
      Tol:=Tol+1;
    End;
  If ((FindColorTolerance(Ex, Ey, OreColor, MSX1,MSY1 ,MSX2, MSY2, Tol))
  And Not (Tol > MaxTol)) Then Result:=True;
  Tol:=1;
  Wait(10);

End;

//----------------------------------------------------------------------------//

procedure PlayerStats;

var PSActive: string;
var i: Integer;
begin
  WriteLn(' ');
  WriteLn(' ');
  WriteLn(' ');
  writeln('**********************************************');
  writeln('Name         : '+ Players[CurrentPlayer].Name);
  writeln('Number       : '+inttostr(CurrentPlayer));
  writeln('Mining Level : '+ inttostr(Players[CurrentPlayer].level[15]));
  writeln('Worked for   : '+IntToStr(Players[CurrentPlayer].Worked)+' minutes.');
  writeln('Banked       : '+ inttostr(Players[CurrentPlayer].Banked) + ' times.');
  if Players[CurrentPlayer].Active=True then PSActive:='True' else PSActive:='False';
  writeln('Active       : '+ PSActive);
  writeln('Location     : '+ Players[CurrentPlayer].loc);
  writeln('**********************************************');

for i := 0 to HowManyPlayers-1 do
   begin
   if Players[i].Active=True then PSActive:='True' else PSActive:='False';
      writeln( (inttostr(i))+' : '+Players[i].name+ ' = '+PSActive+
      '.- Lvl : '+inttostr(Players[i].level[15])+
      '.- B :'+inttostr(Players[i].Banked)+' Times.'+
      '.- A: '+IntToStr(Players[i].Worked)+' mins.'+
      '.- Loc: '+Players[i].loc);
    end
   writeln('**********************************************');
end;

//----------------------------------------------------------------------------//

procedure ProgressReport;
begin
  WriteLn(' ');
  WriteLn(' ');
  WriteLn(' ');
  WriteLn('<============== -'+VersionNumber+'- Progress Report ===============>');
  writeln('Worked for '+ TimeRunning);
  WriteLn('Banked '+IntToStr(banks)+' loads[s].');
  WriteLn('Banked '+IntToStr(TotalOres)+' Ores.');
  WriteLn('<=====================================================>');
  PlayerStats;
  SRLRandomsReport;
end;

//----------------------------------------------------------------------------//

function FindMapOreColor:integer;
var
  MapOre,MapOre2:integer;
begin
  MapOre := BitmapFromString(3, 3,
         '3D2C345948546D5D624A39416D5D626D5D625948546D5D626D5D62' +
         '');
  MapOre2 := BitmapFromString(3, 3,
         '061115222D35364243131E22364243364243222D35364243364243' +
         '');
  if(FindBitmapsProgressiveTol(MapOre,MapOre2,0,0,0,65,5,587,41,705,118))then
    Result:=GetColor(x+1,y+1);
  Freebitmap(MapOre);
  Freebitmap(MapOre2);
end;

//----------------------------------------------------------------------------//

Function FindFaladorLadderColor: Integer;
var  C,TX,TY,FaladorLadder:integer;

begin
FaladorLadder:= BitmapFromString(2, 2, '4F1F004F1F004F1F00' +
       'A4A298');

 while (C<100) do
   begin
   C:=C+5;
   If FindBitMapToleranceIn(FaladorLadder,TX,TY,650,144,664,156,C) then
      begin
            LadderColor:=GetColor(TX,TY);
            Players[CurrentPlayer].Loc:='Falador';
            Result:=LadderColor;
            writeln('LadderColor = '+IntToStr(LadderColor));
            break;
      end
   end
FreeBitMap(FaladorLadder);
if Result = 0 then begin writeln('ERROR: LadderColor NOT Found'); TerminateScript end;
end;

//----------------------------------------------------------------------------//

function Underground:boolean;
begin
  if((FindColoredAreaTolerance(x,y,256,570,5,725,162,50,1)))then
  begin
    Result:=true;
  end;
end;

//----------------------------------------------------------------------------//

procedure ToCenter;
begin
  if(FindColorSpiral(x,y,MapPickColor,570,63,725,160))then
  begin
    Mouse(x-10,y-10,20,20,true);
    FFlag(20);
    Wait(1000+Random(100));
  end else
  begin
    RoadWalk(MapOreColor,'S');
    if(FindColorSpiral(x,y,MapPickColor,570,63,725,160))then
    begin
      Mouse(x-10,y-10,20,20,true);
      FFlag(20);
      Wait(1000+Random(100));
    end;
  end;
end;

//----------------------------------------------------------------------------//

procedure RunAway;
begin
  if(UnderGround)then
  begin
    RoadWalk(MapOreColor,'W');
    ClickMMColor(LadderColor);
    FFlag(10);
    RoadWalk(MapOreColor,'E');
  end else
  RunTo('N',False);
end;

//----------------------------------------------------------------------------//

function HandleGas(Gx,Gy:Integer):Boolean;
begin
      if FindGas(gx,gy) then
      begin
         ToCenter;
         Result:=True;
      end;
end;

//----------------------------------------------------------------------------//

Function ClimbLadderDown:Boolean;
var
  c:integer;
begin
  for c:=1 to 50 do
  begin
    If FindColor(x,y,0,MSX1+10,MSY1+10,MSX2-10,MSY2-10) then
    begin
      Wait(100);
      Mouse(x,y,0,0,false);
      if ChooseOption(x,y,'Climb') then
      begin
         MarkTime(Mark);
         repeat
           Wait((1000)+Random(1000));
           If TimeFromMark(Mark)>30000 then begin Logout; Exit; end;
         until ((GetColor(580,80)=0) and (GetColor(648,142)=0));
      Result:=True;
      Exit;
      end;
    end;
  c:=C+1;
  SendArrowSilentWait((Random(2)*2)+1, 20 + Random(10));
  if C=50 then begin Logout; exit end;
  end;
end;

//----------------------------------------------------------------------------//

Function ClimbLadderUp:Boolean;
var
  c:integer;
begin
  for c:=1 to 50 do
  begin
    Wait(100);
    if FindObj(x,y,'adder',2775161,21) then
      begin
        Wait(100);
        Mouse(x,y,0,0,false);
        if ChooseOption(x,y,'Climb') then
        begin
          MarkTime(Mark);
          repeat
            Wait((1000)+Random(1000));
            If TimeFromMark(Mark)>30000 then begin Logout; Exit; end;
          until FindColor(x,y,WaterColor,MMX1,MMY1,MMX2,MMY2);
          Result:=True;
          Exit;
        end;
      end;
  c:=C+1;
  if C=50 then begin Logout; exit end;
  SendArrowSilentWait((Random(2)*2)+1, 20 + Random(10));
  end;
end;

//----------------------------------------------------------------------------//
// --                To the Guild in Three Clicks!                          --//
//----------------------------------------------------------------------------//

procedure BankToGuild;
var xblack,yblack:Integer;
begin
  PerfectNorth;
  MouseFindFlag(690,110,1,-1);
  Flag;
  FindColor(xblack,yblack,0,MMX1,MMCY,MMX2,MMY2);
  Mouse(xblack-5,yblack+10,0,0,true);
  Flag;
  ClimbLadderDown;
  Players[CurrentPlayer].loc:='Guild';
end;


//----------------------------------------------------------------------------//

procedure GuildToBank;
var
  c:integer;
begin

    repeat
      c:=c+1;
      RadialWalk(MapOreColor,210,270,50,-1,0);
      if FindColor(x,y,LadderColor,MMX1,MMY1,MMX2,MMY2) then break;
      if c=10 then begin Logout; exit; end;
    until( FindColor(x,y,LadderColor,MMX1,MMY1,MMX2,MMY2) or(c>10) )
    IdleTime(3000, 1000, 1.0);
    If FindColor(x,y,LadderColor,MMX1,MMY1,MMX2,MMY2) Then Mouse(x,y,2,2,True);
    Wait(1500+Random(500));
    FFlag(0);
    ClimbLadderUp;

    MouseFindFlag(666,45,-1,-1);
    Flag;
    MakeCompass('N');
    If FindColor(x,y,BankColor,MMX1,MMY1,MMX2,MMY2) then
    begin
      Mouse(x,y,0,0,True);
      FFlag(10);
      DTM3Flag(FB1,FB2,FB3,True);
      FFlag(3);
    end
    else
    begin
      DTM3Flag(FB1,FB2,FB3,True);
      FFlag(3);
    end;
    Players[CurrentPlayer].loc:='Falador';
end;
//----------------------------------------------------------------------------//

Function SimpleBank:Boolean;
var sx,sy,dx,dy,Mark2,Tries:integer;
begin
  SX:=MSCX; SY:=MSCY;
  repeat
    sx:=Sx+1;
    sy:=sy+3;
    MMouse(sx, sy, 0, 0);
    if IsUpTextMulti('e Bank','Booth','ooth') then
    begin
      GetMousePos(Dx, Dy);
      Mouse(Dx, Dy, 0, 0, False);
      if ChooseOption(Dx, Dy, 'uickly')  then
      begin
        MarkTime(Mark2);
        repeat
          Wait(10);
          if TimeFromMark(Mark2) > 20000 then
           begin
             Result:=False;
             Exit;
           end;
        until BankScreen;
        if BankScreen then
        begin
          Result := True;
          Exit;
        end;
      end;
    end
    else
    begin
      wait(1);
      Tries:=Tries+1;
    end;
  until(tries >9);
end;

//----------------------------------------------------------------------------//

procedure Bank;

var LocalOres:integer;
begin
    if (NoPick and EquipPick) then
    begin
       if InventoryFull then
       begin
         if(FindBitmapSpiralTolerance(Ore,x,y,559,210,735,460,25))then
              begin
                Mouse(x,y,5,5,false);
                ChooseOption(x,y,'Drop');
              end;
       end;
       GameTab(5);
       Mouse(593,303,0,0,true);
       Wait(Random(1000)+2000);
       GameTab(4);
    end;

    LocalOres:=CountItemBmpTol(Ore,50);
    MarkTime(Mark);

    if not BankScreen then
    begin
      repeat
         if (not(Loggedin)) then  Exit;
         if not SimpleBank then OpenBankQuiet('feb');
      until(BankScreen or (TimeFromMark(Mark)>60000));
    end;
    if(BankScreen)then
    begin
      Wait(Random(2000)+200);
      FixBank;
      if(NoPick=true)then
      begin
        ClickAllItemsColorWait('All',65536,1000+Random(100));
        Wait(Random(2000)+200);
        Withdraw(1,1,1);
        Wait(Random(2000)+200);
      end else
      begin
        if(EquipPick=false)then Deposit(2,28,2);
        Wait(Random(2000)+200);
        if(EquipPick=true)then
           begin
             ClickAllItemsColorWait('All',65536,1000+Random(100));
             Wait(Random(2000)+200);
           end;
      end;
      CloseBank;
      if(NoPick=true)and(EquipPick=true)then
      begin
        FindPickHeadColor;
        Wait(Random(1000)+200);
        ClickItemColor(hc1,true);
      end;
      Banks:=Banks+1;
      TotalOres:=TotalOres+LocalOres;
      Players[CurrentPlayer].Banked:=Players[CurrentPlayer].Banked+1;
      NoPick:=false
    end;
end;

//----------------------------------------------------------------------------//

Procedure ChangeGasPixels(Var Gasx,GasY:Integer);

Var
   TempX, TempY: Integer;

Begin
  Wait(100);
  If FlagPresent Then
    Begin
      FFlag(0);
      If FindColorSpiralTolerance(x,y,OreColor,MSX1,MSY1,MSX2,MSY2,4) Then
        Begin
        x := TempX;
        y := TempY;
        If CheckOre(x,y,OreColor,4) > 2 Then
          Begin
            If Distance(MSCX,MSCY,TempX,Tempy) < 40 Then
              Begin
                GasX := x;
                GasY := y;
              End;
          End;
        End;
  End;
End;

//----------------------------------------------------------------------------//

Procedure WizzupMine;

Var Dx,Dy,Ex,Ey:Integer;

Begin

  If FindOre(OreTol) Then
  Begin
    If FindObjOre(Dx, Dy, 'Mine', OreColor, 10, 4) Then
    Begin
      H:=0;
      If Not HandleGas(Dx, Dy) Then
      Begin
          If Random (9) < 7 Then Mouse(Dx, Dy, 0, 0, True)
          Else
          Begin
            Mouse(Dx, Dy, 0, 0, False);
            ChooseOption(Ex, Ey, 'ine');
          End;
      ChangeGasPixels(Dx,Dy);
      MarkTime(Mark);
      Repeat
        HandleGas(Dx, Dy);
        Wait(100);
        FindTalk;
        FindPick;
        If NoPick Then Break;
        If FindFight Then RunAway;
      Until ((TimeFromMark(Mark) > (1000 * SecondsToWait))
      Or (FindColor(X, Y, 0,51, 421, 51, 421)))
      End;
    End;
  End
  Else
  Begin
    If H>1 Then H:=0;
    If Random(9) < 7 Then if not FindColorTolerance(x,y,CoalColor, MSX1,MSY1,MSX2,MSY2,OreTol) then ToCenter;
    FindNormalRandoms;
    If FindFight Then RunAway;
    Wait(500+Random(500));
  End;
End;

//----------------------------------------------------------------------------//

Procedure DoChats;

Begin
  SetChat('On', 1);
  SetChat('On', 1);
  SetChat('Off', 2);
  SetChat('Off', 2);
  SetChat('On', 3);
  SetChat('On', 3);
End;

//----------------------------------------------------------------------------//

procedure Setup;
begin
     SetupSRL;
     SetUpSRLMining;
     FillMem;
     DeclarePlayers;
     CurrentPlayer:=StartPlayer;
     EquipPick:= Players[CurrentPlayer].Boolean1;  // Wielding.
     PickUpItems:=True; // to pick up random items when pickhead is gone.
     BenMouse:=False;
     MouseSpeed:=10;
     LoginPlayer;       // logs in the first player.
     SetOres;
end;

//----------------------------------------------------------------------------//
//*************************** Main Loop***************************************//
//----------------------------------------------------------------------------//

begin
  Setup;
  FindFaladorLadderColor;
  SymbolAccuracy:=0.4;   // temporarily reduce symbolaccuracy for better symbol spotting
  FindFaladorBasicColors;
  SymbolAccuracy:=0.8; // set symbolacc. to default
  NickNameBMP:=CreateBitmapMaskFromText(Players[CurrentPlayer].Nick,UpChars) // in case we started logged in aot logged out

  repeat
      GetAllLevels;
      if not FindPickHeadColor then Logout;

      Dochats;
      if Players[CurrentPlayer].loc='Falador' then
        begin
         SetRun(true);
         BankToGuild;
        end

      if Players[CurrentPlayer].loc='Guild' then
        begin
          if(MapOreColor=0) then MapOreColor:=FindMapOreColor;

          if FindMMColor(x, y, LadderColor) then RoadWalk(MapOreColor,'E');
          FFlag(10);

          MarkTime(Mark);
              if(MapPickColor=0) then MapPickColor:=GetSymbolColor(x,y,'mining spot');
          repeat
            WizzupMine;
            Wait(100);
            if (not(Loggedin)) then  break;
          until(InventoryFull)or(NoPick=true)or(TimeFromMark(Mark)>1800000)

          SetRun(False);
          GuildToBank;
          Bank;
          ProgressReport;
        end;
      if ((LoggedIn) and (Players[CurrentPlayer].Banked mod Loads = 0) ) then
        Begin
          MarkTime(Mark);
          SetChat('off',1);
          repeat
             Wait(1000);
             FindNormalRandoms;
             if(TimeFromMark(Mark)>120000) then begin Logout; Break; end;
          until(not(LoggedIn));
          writeln('dead and logging back in');
          writeln(InttoStr(CurrentPlayer));
          Wait(500+Random(501));
          NextPlayer(True);
          writeln(InttoStr(CurrentPlayer));
          NoPick:=False;
          SetOres;
          EquipPick := Players[CurrentPlayer].Boolean1;
          FindPickHeadColor;
          DoChats;
        end;

      if (not (Loggedin)) then
        Begin
          NextPlayer(False);
          NoPick:=False;
          SetOres;
          EquipPick := Players[CurrentPlayer].Boolean1;
          FindPickHeadColor;
          DoChats;
      End;
  Until(False)
end.