• Log in or sign up for an account here: https://www.sythe.org/login

Problem with Runescape Scripts

  • Thread starter Thread starter ashmaker0
  • Start date Start date
A

ashmaker0

Guest
When I try and run nearly every Runescape script such as Summillion's Rimmington Miner

Code:
{===================================================================]
[                   Sumilions Rimmington Miner                      ]
[                                                                   ]
[           NAME        : Sumilions Rimmington Miner                ]
[           WRITER      : Sumilion                                  ]
[           CATEGORY    : Miner                                     ]
[           DESCRIPTION : Mines in Rimmington, banks in Falador     ]
[           USAGE       : Start at bankbooth in Falador             ]
[           AUTOCOLOR   : Partially                                 ]
[           SRL Used    : 3.7 (DIVI)                                ]
[                                                                   ]
[                   More Scripts can be found at                    ]
[                        www.SRL-Forums.com                         ]
[===================================================================]
[                           Instructions.                           ]
[===================================================================]
[ 1. USE Runescape with Low Detail, Very Bright.                    ]
[ 2. Set your Screen to 32 bit TRUE color.                          ]
[ 3. Setup lines below                                              ]
[ 4. Set CopperRockMMColor (and NormalRockMMColor)!!!               ]
[ 5. Set Playernames and Passwords below.                           ]
[ 6. Have Pick in First invslot or wielded and more in the bank     ]
[ 7. Start script Logged Out / Logged in                            ]
[===================================================================]
[ Credits to :                                                      ]
[    Wizzup?  -->  For the GetRockColor; function.                  ]
[===================================================================}
program SumilionsRimmingtonMiner;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/Mining.scar}

//********Color Settings********\\
const
  CopperRockMMColor = 2903155; // You HAVE to fill this in, it wont work otherwise.
  NormalRockMMColor = 5197639; // If below is true, then there is no need to fill this in.
  AutoMMRockColor   = False;   // Use Wizzups MinimapRockColor finder (not adviced)?

//********Player Settings********\\
const
  MinutesPerPlayer = 15;     // Time in minutes per player
  MaxSecRock       = 5;      // Maximum seconds to wait for a rock
  StartPlayer      = 0;      // With what player do you want to start ?
  UseBenMouse      = True;   // Use BenMouse? (Some people say its good for anti-ban)
  RunDir           = 'N';    // Direction to run to when in fight
  RunFar           = True;   // Run far when in fight ?

//********Additional Settings********\\
  SRLStatsID       = '';     // Your SRL ID for the stats (Leave blanc to set it to default, from SetupSRL.scar)
  SRLStatsPW       = '';     // Your Password for the stats (Leave blanc to set it to default, from SetupSRL.scar)
  VersionNumber    = '0.13'; // No need to change this
  TheMinCount      = 5;      // No need to change this
  BoxSize          = 15;     // No need to change this
  RemoteMaster     = 'umil'; // For advanved users only.

//********Player Settings********\\
procedure DeclarePlayers;
begin
  HowManyPlayers := 5;//MAKE SURE THIS ONE IS CORRECT!

  CurrentPlayer := StartPlayer;
  NumberOfPlayers(HowManyPlayers);

  Players[0].Name    := 'Username'; // Your Runescape name
  Players[0].Pass    := 'Password'; // The corresponding password
  Players[0].Nick    := 'ern';      // 3-4 letters from your name, NO CAPITALS (that includes the first character)
  Players[0].String1 := 'Iron';     // Type of ore to mine (Clay / Copper / Tin / Iron / Gold)
  Players[0].String2 := '0000';     // Your BankPinNumber
  Players[0].Active  := True;

  Players[1].Name    := 'Username';
  Players[1].Pass    := 'Password';
  Players[1].Nick    := 'ern';
  Players[1].String1 := 'Copper';
  Players[1].String2 := '0000';
  Players[1].Active  := True;

  Players[2].Name    := 'Username';
  Players[2].Pass    := 'Password';
  Players[2].Nick    := 'ern';
  Players[2].String1 := 'Tin';
  Players[2].String2 := '0000';
  Players[2].Active  := True;

  Players[3].Name    := 'Username';
  Players[3].Pass    := 'Password';
  Players[3].Nick    := 'ern';
  Players[3].String1 := 'Gold';
  Players[3].String2 := '0000';
  Players[3].Active  := True;

  Players[4].Name    := 'Username';
  Players[4].Pass    := 'Password';
  Players[4].Nick    := 'ern';
  Players[4].String1 := 'Iron';
  Players[4].String2 := '0000';
  Players[4].Active  := True;
end;

//********RockColor Settings********\\
const
  CopperColor = 4421053;
  TinColor    = 8224391;
  ClayColor   = 6196645;
  IronColor   = 2899043;
  GoldColor   = 1952246;

//********Dont go below unless your more advanced********\\
var
  GasAvoided, bmpOreMask, bmpClayMask, RunTime, MinCount,
  FalaRoadColor, MiningSiteColor, dtmBanker, dtmBank, RockColor,
  a, GemsReceived, OresMined, TotalLoads, bmpGemMask: Integer;
  dtmPaxes: array[1..6] of Integer;
  PinNumber: string;
  AngleVar: Extended;
  PlayerStatus: Boolean;

//-----------------------------------------------------------------\\
{            ProgressReport - Sets up the player array             ||
\\-----------------------------------------------------------------//}
procedure ProgressReport;//Made by Fakawi, i think, edited by me

var
  PActive, Spaces: string;
  I, K, SpaceNumber: Integer;
begin
  SRLRandomsReport;
  if Players[CurrentPlayer].Active then
    PActive:='True'
  else
    PActive:='False';
  Writeln(' ');
  Writeln('<========== RimmingtonMiner ============>');
  Writeln('<======= -'+VersionNumber+'- Progress Report ========>');
  Writeln('/=======================================\');
  Writeln('      Worked for '+ TimeRunning);
  Writeln('      Banked '+IntToStr(TotalLoads)+' loads[s].');
  Writeln('      Mined '+inttostr(OresMined)+(' ores.'));
  if(GemsReceived > 0)then
    Writeln('      Received '+IntToStr(GemsReceived)+(' gem[s].'));
  if(GasAvoided > 0)then
    Writeln('      Avoided gas '+IntToStr(GasAvoided)+(' time[s].'));
  Writeln('\=======================================/');
  Writeln('    Name       : '+Players[CurrentPlayer].Name);
  Writeln('    Mining Lvl : '+IntToStr(Players[CurrentPlayer].Level[15]));
  Writeln('    Worked for : '+IntToStr(Players[CurrentPlayer].Worked)+' minutes.');
  Writeln('    Banked     : '+IntToStr(Players[CurrentPlayer].Banked)+' time[s].');
  Writeln('    Active     : '+PActive);
  Writeln('    Location   : '+Players[CurrentPlayer].Loc);
  Writeln('\\-------------------------------------//');
  for I := 0 to HowManyPlayers-1 do
  begin
    if Players[I].Active then
      PActive:='True'
    else
      PActive:='False';
    SpaceNumber := 12 - Length(Players[I].Name);
    for K := 0 to SpaceNumber do
      Spaces := Spaces + ' ';
    Writeln(IntToStr(I)+': '+Players[I].Name + Spaces +
    '= ' + PActive + ', ' + IntToStr(Players[I].Banked) + ' Bank[s]' +
    ', Worked ' + IntToStr(Players[I].Worked) + ' minutes, ' +
    'Loc: ' + Players[I].Loc);
    Spaces := '';
  end
  Writeln('<==========================================>');
end;

//-----------------------------------------------------------------\\
{           LoadImages - Loads the images in the memory            ||
\\-----------------------------------------------------------------//}
procedure LoadImages;
begin
  bmpOreMask := BitmapFromString(9, 8, 'z78DA333040076E6080C9C60' +
       'F064A17F17A71E9C2AFD70D03E09725DE4CF2DC0F00DCD05C59');
  bmpClayMask := BitmapFromString(9, 6, 'z78DA33302016B88101F' +
       '12A4905B86CC1AF9E3CB7E1329F787F218B03004FC54795');
  bmpGemMask := BitmapFromString(23, 24, 'z78DA3330183EC00D0C686732' +
       'F10097AEC1E33BFC2EA77F08936AD7A84B465D428C8DA32E19750' +
       '931F68EBA6434B50C45978CCC929F785B68ED1E52CDA76E9B90BA' +
       '7E74A3180CFE3E0200FDE18F27');
  dtmPaxes[1] := DTMFromString('78DA637463646008664001068A0C0C5C401A2' +
       '8C3F01F0818C381AC40543536FE11703520C0E80B6479A0AAF149' +
       '2D405103000A07084F');  //Rune
  dtmPaxes[2] := DTMFromString('78DA631463646008634001068A0C0C5C401A2' +
       '8C3F01F08183580AC405435561E56703520C028076479A0AAF188' +
       'F142510300D923076A');  //Addy
  dtmPaxes[3] := DTMFromString('78DA637CCEC0C010C680020C141918B880342' +
       '310FF0702C69F404620AA1A73F300B81A10607C0F243C50D5B8BA' +
       'A7A3A8010086BD09E1');  //Mith
  dtmPaxes[4] := DTMFromString('78DA63DCC9C0C010CC80020C141918B880342' +
       '310FF0702C653404620AA9ACCA424B81A10603C00243C50D5B4D6' +
       'D4A0A801007D560A4B');  //Steel
  dtmPaxes[5] := DTMFromString('78DA63EC62606008654001068A0C0C5C409A1' +
       '188FF0301E36C202310558DBB93135C0D08304E04121EA86AA242' +
       '4250D400003C4908E3');  //Iron
  dtmPaxes[6] := DTMFromString('78DA638C62606008634001068A0C0C5C409A1' +
       '188FF0301630E901188AAC6D1480EAE0604189380843BAA1A3B2D' +
       '0614350000CD0781');    //Bronze
  dtmBanker := DTMFromString('78DA636C66626008634001972E5E66F80FA41' +
       '981F83F1030B601D5C4A0AAF9F38789810BAA0604189B8850D345' +
       '580D00CA7B110D'); //From GuildRaper
  dtmBank := DTMFromString('78DA630C64626030614001BBD64F61D000D28' +
       'C40FC1F081863816A9C20724C50356FDF32C0D580006334A69A3F' +
       '7F9850D58403651C50D5FCFB278CAA260428E348C09C004C3518E' +
       'E09C66F172B100300D8741716');
end;

//-----------------------------------------------------------------\\
{            KeepUpStats - Updates current statistics              ||
\\-----------------------------------------------------------------//}
procedure KeepUpStats;
begin
  ProgressReport;
  OresMined := OresMined + CountItemBmpMaskTol(bmpOreMask, 5, 5) + CountItemBmpMaskTol(bmpClayMask, 5, 5);
  ReportVars[0] := ReportVars[0] + CountItemBmpMaskTol(bmpOreMask, 5, 5) + CountItemBmpMaskTol(bmpClayMask, 5, 5);
  GemsReceived := GemsReceived + CountItemBmpMaskTol(bmpGemMask, 5, 5);
  ReportVars[3] := ReportVars[3] + CountItemBmpMaskTol(bmpGemMask, 5, 5);
  TotalLoads := TotalLoads + 1;
  ReportVars[1] := ReportVars[1] + 1;
  Players[CurrentPlayer].Banked := Players[CurrentPlayer].Banked + 1;
end;

//------------------------------------------------------------------------\\
{                PlayerLost - Logs out player when lost                   ||
\\------------------------------------------------------------------------//}
procedure PlayerLost(Info:string);
begin
  Writeln('Player Lost, '+ Info);
  Logout;
end;

//-----------------------------------------------------------------\\
{               SetOreColor - Sets correct OreColor                ||
\\-----------------------------------------------------------------//}
procedure SetOreColor;
begin
  case LowerCase(Players[CurrentPlayer].String1) of
    'copper'  :  OreColor := CopperColor;
    'tin'     :  OreColor := TinColor;
    'clay'    :  OreColor := ClayColor;
    'iron'    :  OreColor := IronColor;
    'gold'    :  OreColor := GoldColor;
  end;
  if(OreColor = 0)then
    Writeln('String1 is NOT set properly or color is 0...');
end;

//-----------------------------------------------------------------\\
{            FindFastRandoms - Finds the randoms fast              ||
\\-----------------------------------------------------------------//}
function FindFastRandoms: Boolean; // By WT-Fakawi.
var
  i: Integer;
begin
  for I := 1 to 11 do
  begin
    case I of
       1:  if FindDead then
             Result := True;

       2:  if FindMod then
             Result := True;

       3:  if FindMime then
             Result := True;

       4:  if FindMaze then
             Result := True;

       5:  if FindQuiz then
             Result := True;

       6:  if FindDemon then
             Result := True;

       7: begin
             if NoGameTab then
             begin
               Result := True;
               Players[CurrentPlayer].loc := 'No GameTab';
               Logout;
               Exit;
             end;
           end;

       8: begin
            if InBlack then
            begin
              Result := True;
              Players[CurrentPlayer].loc := 'InBlack';
              Logout;
              Exit;
            end;
          end;

       9 : if RC then
             Result := True;

       10 : if FindFight then
              begin
                Result := True;
                RunTo(RunDir, RunFar);
              end;

       11: if FindTalk then
             Result := True;
    end;
    Wait(1);
  end;
end;

//-----------------------------------------------------------------\\
{          SumFindPickHeadColor - Gets pickhead colors             ||
\\-----------------------------------------------------------------//}
function SumFindPickHeadColor: Boolean;
var
  InvPAxe, WieldPAxe, Ix, Iy, Wx, Wy: integer;
begin
  GameTab(4);
  for InvPAxe := 1 to 7 do
  begin
    if(InvPAxe = 7)then
      Break;
    if(FindDtm(dtmPaxes[InvPAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
      Break;
  end;
  GameTab(5);
  Wait(500);
  for WieldPAxe := 1 to 7 do
  begin
    if(WieldPAxe = 7)then
      Break;
    if(FindDtm(dtmPaxes[WieldPAxe], Wx, Wy, MIX1, MIY1, MIX2, MIY2))then
      Break;
  end;

  if(InvPAxe = 7)and(WieldPAxe = 7)then
  begin
    Result := False;
    Exit;
  end;
  if((InvPAxe-WieldPAxe) < 0)then
    EquipPick := False
  else
    EquipPick := True;
  Result := true;
  if(EquipPick)then
  begin
    GameTab(5);
    hc1 := GetColor(585, 295);
    hc2 := GetColor(597, 297);
    hc3 := GetColor(594, 296);
    hc4 := GetColor(588, 295);
    hc5 := GetColor(582, 294);
  end else
  begin
    GameTab(4);
    if(Ix > 592)and(Iy > 238)then
      Drag(Ix, Iy, 5, 5, 579, 227, 5, 5, true);
    FindDtm(dtmPaxes[InvPAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2);
    hc1 := GetColor(587, 216);
    hc2 := GetColor(587, 219);
    hc3 := GetColor(592, 222);
    hc4 := GetColor(584, 216);
    hc5 := GetColor(577, 219);
  end;
  WriteLn('Pick head colors... ' + IntToStr(hc1) + ' ' + IntToStr(hc2) + ' ' +
          IntToStr(hc3) + ' ' + IntToStr(hc4) + ' ' + IntToStr(hc5));
end;

//-----------------------------------------------------------------\\
{     SumFindRoadColor - Finds both road colors on the screen      ||
\\-----------------------------------------------------------------//}
function SumFindRoadColor(FalaColor: Boolean): Integer;
var
  arRoadPoints: TPointArray;
  GenericColor, a, b: Integer;
  arRoughRoadColors, arRoadColors: array of Integer;
  WeGotIt: Boolean;
begin
  if(FalaColor)then
    GenericColor := 6057843
  else
    GenericColor := 5921377;
  ColorToleranceSpeed(2);
  SetColorspeed2Modifiers(10.0, 0.03);
  FindColorsTolerance(arRoadPoints, GenericColor, MMX1, MMY1, MMX2, MMY2, 50);
  ColorToleranceSpeed(1);
  arRoughRoadColors := GetColors(arRoadPoints);
  for a := 0 to GetArrayLength(arRoughRoadColors) - 1 do
  begin
    WeGotIt := False;
    if(arRoughRoadColors[a] > 5000000)and(arRoughRoadColors[a] < 8000000)then
    begin
      for b := 0 to GetArrayLength(arRoadColors) - 1 do
      begin
        if(arRoadColors[b] = arRoughRoadColors[a])then
          WeGotIt := True;
      end;
      if not(WeGotIt)then
      begin
        if(CountColor(arRoughRoadColors[a], MMX1, MMY1, MMX2, MMY2) > 200)then
        begin
          Writeln(IntToStr(arRoughRoadColors[a]));
          SetArrayLength(arRoadColors, GetArrayLength(arRoadColors) + 1);
          arRoadColors[GetArrayLength(arRoadColors) - 1] := arRoughRoadColors[a];
        end;
      end;
    end;
  end;
  if not(GetArrayLength(arRoadColors) = 1)then
  begin
    Writeln('Failed to find the road using SumFindRoadColor.');
    Writeln('Trying default autocoloring.');
    if(FalaColor)then
      Result := FindFallyRoadColor
    else
      Result := FindRoadColor;
  end else
    Result := arRoadColors[0];
  Writeln('RoadColor = '+IntToStr(Result));
  if(Result = 0)then
  begin
    Writeln('Failed to find the road color.');
    Writeln('Leaving it what it was.');
    if(FalaColor)then
      Result := FalaRoadColor
    else
      Result := RoadColor;
  end;
end;

function ColorsAtColor(CPoint: TPoint; Color: Integer; Colors: TIntegerArray): Boolean;
var // <3 Wizzup
   I: Integer;
begin
  if CountColor(Color, CPoint.X - 8, CPoint.Y - 8, CPoint.X + 8, CPoint.Y + 8) > 8 then
  begin
    for I := 0 to GetArrayLength(Colors) - 1 do
      if(CountColor(Colors[i], CPoint.X - 8, CPoint.Y - 8, CPoint.X + 8, CPoint.Y + 8) > 4)Then
      begin
        if(Colors[i] <> Color)then
        begin
          WriteLn('Found Color ' +IntToStr(Colors[i]) + ' too.');
          Result := True;
          Exit;
        end;
      end;
  end;
end;

function NumInArray(Num: Integer; TheArray: TIntegerArray): Boolean;
var // <3 Wizzup
  I, TheArrayLength: Integer;
begin
  TheArrayLength := GetArrayLength(TheArray) - 1;
  for I := 0 to TheArrayLength do
  begin
    if Num = TheArray[i] then
    begin
      Result := True;
      Exit;
    end;
  end;
end;

function ColorsTol(C1, C2: Integer): integer;
var // <3 Wizzup
  I : integer;
begin
  for I := 0 to 255 do
    if SimilarColors(C1, C2, I) then Break;
  if I <> 255 then Result := I;
end;

Type
  AColor = Record
    Color: Integer;
    Amount: Integer;
    Point: TPoint;
End;

var
   Colors: array of AColor;

function GetRockColor: Integer;
var // <3 Wizzup
  Points, PosResultsP, PosResults2P: TPointArray;
  Found: array of TPointArray;
  CColors, PosResults, PosResults2: array of Integer;
  I: Integer;
  H, S, L: Extended;
begin
  ColorToleranceSpeed(2);
  SetColorSpeed2Modifiers(0.9, 0.2);
  FindColorsTolerance(Points, 5266264, 540, 5, 740, 155, 60);
  //WriteLn('P2 Found ' + IntToStr(GetArrayLength(Points)));
  CColors := GetColors(Points);
  //WriteLn('Colors Found ' + IntToStr(GetArrayLength(CColors)));

  SetArrayLength(Colors, GetArrayLength(CColors));
  for I := 0 to GetArrayLength(CColors) - 1 do
  begin
    Colors[i].Color := CColors[i];
    Colors[i].Point := Points[i];
  end;

  for I := 0 to GetArrayLength(Colors) - 1 do
  begin
    ColorToHSL(Colors[i].Color, H, S, L);
    //If ((L > 15) And (L < 40) And (S < 50)) Then
    if((L > 15)and(L < 40)and(S < 50)and(H > 10)and(H < 95))then
      if not NumInArray(Colors[i].Color, PosResults)then
      begin
        SetArrayLength(PosResults, GetArrayLength(PosResults) + 1);
        PosResults[GetArrayLength(PosResults) - 1] := Colors[i].Color;
        SetArrayLength(PosResultsP, GetArrayLength(PosResultsP) + 1);
        PosResultsP[GetArrayLength(PosResultsP) - 1] := Colors[i].Point;
     end;
  end;
  for I := 0 to GetArrayLength(PosResults) - 1 do
  begin
    SetArrayLength(Found, GetArraylength(Found) + 1);
    FindColorsTolerance(Found[i], PosResults[i], 540, 5, 740, 155, 0);
    {WriteLn('Possible Colors['+IntToStr(I) + '] F ' +
    IntToStr(GetArrayLength(Found[i])) + ' = '+
    IntToStr(PosResults[i])+ ' With a tol of ' +
    IntToStr(ColorsTol(PosResults[i], 5266264)));}
  end;

  for I := 0 to GetArrayLength(PosResults) - 1 do
  begin
    if (GetArrayLength(Found[i]) > 5) and (GetArrayLength(Found[i]) < 400)then
    begin
      if (ColorsAtColor(PosResultsP[i], PosResults[i], PosResults))and
        (rs_OnMiniMap(PosResultsP[i].X, PosResultsP[i].Y))then
      begin
        SetArrayLength(PosResults2, GetArrayLength(PosResults2) + 1);
        PosResults2[GetArrayLength(PosResults2) - 1] := PosResults[i];
        SetArrayLength(PosResults2P, GetArrayLength(PosResults2P) + 1);
        PosResults2P[GetArrayLength(PosResults2P) - 1] := PosResultsP[i];
      end;
    end;
  end;

  for I := 0 to GetArrayLength(PosResults2) - 1 do
  begin
    ColorToHSL(PosResults2[i], H, S, L);
    {WriteLn('Possible Colors2['+IntToStr(I) + '] F ' +
    IntToStr(GetArrayLength(Found[i])) + ' = '+
    IntToStr(PosResults2[i]) + ' H ' + FloatToStr(H) + ' S ' +FloatToStr(S)
    + ' L ' + FloatToStr(L));
    Wait(500);}
    Result := PosResults[I];
    if(Result > 0)then
      Break;
  end;
end;

//-----------------------------------------------------------------\\
{               SumCheckGas - Checks if there is gas               ||
\\-----------------------------------------------------------------//}
function SumCheckGas(rx, ry: Integer): Boolean;
var
  TempMouseSpeed, GasTime: Integer;
begin
  Result := FindGas(rx, ry - 20);
  if(Result)then
  begin
    Writeln('Gas found!');
    TempMouseSpeed := MouseSpeed;
    MouseSpeed := 5;
    MouseFindNoFlag(MMCX, MMCY + 4, 1, 1);
    MarkTime(GasTime);
    MouseSpeed := TempMouseSpeed;
    while(TimeFromMark(GasTime) < 35000)do
      if(Random(20) > 15)then
        IdleTime(500, 500, 0.4)
      else
        Wait(500 + Random(500));
    GasAvoided := GasAvoided + 1;
    ReportVars[2] := ReportVars[2] + 1;
  end;
end;

//-----------------------------------------------------------------\\
{             getArrayFromBox - Gets colors in groups              ||
\\-----------------------------------------------------------------//}
function getArrayFromBox(arColor: TPointArray; Width, Height: Integer): TPointArray;
var
  Count, Count3: Integer;
  DoNotAccept : Boolean;
begin
  SetArrayLength(Result, 1);
  Result[0] := arColor[0];

  for Count := 1 to GetArrayLength(arColor) - 1 do
  begin
    if(arColor[Count].x < arColor[Count - 1].x + Width)and
      (arColor[Count].y < arColor[Count - 1].y + Height)and
      (arColor[Count].x > arColor[Count - 1].x - Width)and
      (arColor[Count].y > arColor[Count - 1].y - Height)then
    else
    begin
      DoNotAccept := False;
      for Count3 := 0 to GetArrayLength(Result) - 1 do
      begin
        if (arColor[Count].x < Result[Count3].x + Width)and
           (arColor[Count].y < Result[Count3].y + Height)and
           (arColor[Count].x > Result[Count3].x - Width)and
           (arColor[Count].y > Result[Count3].y - Height)then
          DoNotAccept := True;
        if DoNotAccept then
          Break;
      end;
      if (DoNotAccept = False) then
      begin
        SetArrayLength(Result, GetArrayLength(Result) + 1);
        Result[GetArrayLength(Result) - 1] := arColor[Count];
      end;
    end;
  end;
end;

//-----------------------------------------------------------------\\
{             IsOre - Did we found an ore or a rock ?              ||
\\-----------------------------------------------------------------//}
function IsOre(rx, ry: Integer): Boolean;
begin
  Result := FindColorSpiralTolerance(x, y, 4481401, rx - 5, ry - 5, rx + 5, ry + 5, 5);
end;

//-----------------------------------------------------------------\\
{              FindRockCenter - Finds the rock center              ||
\\-----------------------------------------------------------------//}
function FindRockCenter(var RockPoint: TPoint; RockColor, BoxSize, RockMinimum: Integer): Boolean;
var
  c, MaxTime: Integer;
  arRoughRockPoints, arRockPoints: TPointArray;
begin
  FindColorsSpiralTolerance(MSCX, MSCY, arRoughRockPoints, RockColor, MSX1, MSY1, MSX2, MSY2, 5);
  if(GetArrayLength(arRoughRockPoints) < 1)then
    Exit;
  MarkTime(MaxTime);
  for c := 0 to GetArrayLength(arRoughRockPoints) - 1 do
  begin
    if not(IsOre(arRoughRockPoints[c].x, arRoughRockPoints[c].y))then
    begin
      RockPoint.x := 0;
      RockPoint.y := 0;
      ColorToleranceSpeed(2);
      SetColorspeed2Modifiers(0.4, 0.4);
      FindColorsTolerance(arRockPoints, 940676, arRoughRockPoints[c].x - BoxSize, arRoughRockPoints[c].y - BoxSize, arRoughRockPoints[c].x + BoxSize, arRoughRockPoints[c].y + BoxSize, 3);
      for a := 0 to GetArrayLength(arRockPoints) - 1 do
      begin
        RockPoint.x := RockPoint.x + arRockPoints[a].x;
        RockPoint.y := RockPoint.y + arRockPoints[a].y;
      end;
      if(GetArrayLength(arRockPoints) <> 0)and
        (RockPoint.x <> 0)and(RockPoint.y <> 0)then
      begin
        RockPoint.x := RockPoint.x / GetArrayLength(arRockPoints);
        RockPoint.y := RockPoint.y / GetArrayLength(arRockPoints);
        MMouse(RockPoint.x, RockPoint.y, 5, 5);
        ColorToleranceSpeed(1);
        Result := (GetArrayLength(arRockPoints) > RockMinimum)and
                  (IsUpText('Mine'));
      end;
      if(Result)or(TimeFromMark(MaxTime) > 5000)then
        Break;
      Wait(100);
    end;
  end;
end;

//-----------------------------------------------------------------\\
{    FindRockCenterBetter - Gets the center using a coordinate     ||
\\-----------------------------------------------------------------//}
function FindRockCenterBetter(var RockPoint: TPoint; rx, ry, BoxSize, RockMinimum: Integer): Boolean;
var
  fx, fy: Integer;
  arRockPoints: TPointArray;
begin
  if not(FindColorSpiralTolerance(fx, fy, 940676, rx - 5, ry - 5, rx + 5, ry + 5, 5))then
  begin
    fx := rx;
    fy := ry;
  end;
  RockPoint.x := 0;
  RockPoint.y := 0;
  ColorToleranceSpeed(2);
  SetColorspeed2Modifiers(0.4, 0.4);
  FindColorsTolerance(arRockPoints, 940676, fx - BoxSize, fy - BoxSize, fx + BoxSize, fy + BoxSize, 3);
  for a := 0 to GetArrayLength(arRockPoints) - 1 do
  begin
    RockPoint.x := RockPoint.x + arRockPoints[a].x;
    RockPoint.y := RockPoint.y + arRockPoints[a].y;
  end;
  if(GetArrayLength(arRockPoints) <> 0)and
    (RockPoint.x <> 0)and(RockPoint.y <> 0)then
  begin
    RockPoint.x := RockPoint.x / GetArrayLength(arRockPoints);
    RockPoint.y := RockPoint.y / GetArrayLength(arRockPoints);
    Result := GetArrayLength(arRockPoints) > RockMinimum;
  end;
  ColorToleranceSpeed(1);
end;

//-----------------------------------------------------------------\\
{               RockGone - Did we lost the rock ?                  ||
\\-----------------------------------------------------------------//}
function RockGone(rx, ry: Integer): Boolean;
begin
  Result := not FindColorSpiralTolerance(rx, ry, OreColor, rx - 10, ry - 10, rx + 10, ry + 10, 10);
end;

//-----------------------------------------------------------------\\
{       GetNewPick - Goes to get a new pick from the bank          ||
\\-----------------------------------------------------------------//}
procedure MineToBank; forward;
procedure BankToMine; forward;
procedure SLBank(WithdrawNewPick: Boolean); forward;
procedure GetNewPick;
begin
  MineToBank;
  SLBank(True);
  BankToMine;
end;

//-----------------------------------------------------------------\\
{          WorkUntilMined - Loops until we're done mining          ||
\\-----------------------------------------------------------------//}
procedure WorkUntilMined(wx, wy, InvSpot: Integer);
var
  i, MineTime: Integer;
begin
  MarkTime(MineTime);
  while(LoggedIn)do
  begin
    for i := 0 to 6 do
    begin
      case i of
        0 : if not(FindPick)then
            begin
              Writeln('We lost our pick axe.');
              Break;
            end;
        1 : if(FindFastRandoms)then
              Break;
        2 : if(SumCheckGas(wx, wy))then
              Break;
        3 : if(ExistsItem(InvSpot))then
              Exit;
        4 : if(RockGone(wx, wy))then
              Exit;
        5 : if(TimeFromMark(MineTime) > MaxSecRock * 1000)then
              Exit;
        6 : if(NoPick)then
              GetNewPick;
      end;
      Wait(1);
    end;
    if(Random(100) > 90)then
      IdleTime(500, 500, 0.4);
  end;
  PlaySound('C:\WINDOWS\Media\winAquariumCritStop.wav');
end;

//-----------------------------------------------------------------\\
{         UpdateRockCoord - Updates the coord of the rock          ||
\\-----------------------------------------------------------------//}
function UpdateRockCoord(var ux, uy: Integer; UColor: Integer): Boolean;
var
  FailSafeTime, i: Integer;
  RockPoint: TPoint;
begin
  if not(FlagPresent)then
  begin
    Result := True;
    Exit;
  end;
  MarkTime(FailSafeTime);
  while(FindColorSpiralTolerance(ux, uy, UColor, ux - 20, uy - 20, ux + 20, uy + 20, 10))and
       (TimeFromMark(FailSafeTime) < 20000)and
       (FlagPresent)do
  begin
    Result := FindRockCenterBetter(RockPoint, ux, uy, BoxSize, MinCount);
    Wait(16);
    ux := RockPoint.x;
    uy := RockPoint.y;
  end;
  for i := 0 to 62 do
  begin
    Result := FindRockCenterBetter(RockPoint, ux, uy, BoxSize, MinCount);
    Wait(8);
    ux := RockPoint.x;
    uy := RockPoint.y;
  end;
end;

//-----------------------------------------------------------------\\
{                    SumMine - Mines the rock                      ||
\\-----------------------------------------------------------------//}
function SumMine: Boolean;
var
  rx, ry, InvSpot: Integer;
  RockPoint: TPoint;
begin
  Result := FindRockCenter(RockPoint, OreColor, BoxSize, MinCount);
  if(Result)then
  begin
    if(SumCheckGas(RockPoint.x, RockPoint.y))then
      Exit;
    for InvSpot := 1 to 28 do
      if not(ExistsItem(InvSpot))then
        Break;
    GetMousePos(rx, ry);
    if Random (20) < 19 then
      Mouse(rx, ry, 0, 0, True)
    else begin
      Mouse(rx, ry, 0, 0, False);
      ChooseOption(x, y, 'Mine');
    end;
    if not(UpdateRockCoord(RockPoint.x, RockPoint.y, GetColor(RockPoint.x, RockPoint.y)))then
      Exit;
    WorkUntilMined(RockPoint.x, RockPoint.y, InvSpot);
  end;
end;

//-----------------------------------------------------------------\\
{           GoToCorrectSpot - Goes to the correct spot             ||
\\-----------------------------------------------------------------//}
procedure GoToCorrectSpot;
begin
  if(RockColor = 0)then
  begin
    if(AutoMMRockColor)then
      RockColor := GetRockColor
    else
      RockColor := NormalRockMMColor;
    Writeln('RockColor = ' + IntToStr(RockColor));
  end;
  case OreColor of
    TinColor  :
    begin
      RadialWalk(RockColor, 90, 130, 100, -1, -1);
      Flag;
    end;
    IronColor :
    begin
      RadialWalk(RockColor, 250, 290, 100, 1, 0);
      Flag;
    end;
    ClayColor :
    begin
      RadialWalk(CopperRockMMColor, 50, 120, 70, 1, 0);
      Flag;
    end;
    GoldColor :
    begin
      RadialWalk(RockColor, 170, 210, 100, 1, 0);
      Flag;
    end;
  end;
end;

//-----------------------------------------------------------------\\
{           SumFindBank - Finds falador bankers on MM              ||
\\-----------------------------------------------------------------//}
function SumFindBank(var bx, by: Integer): Boolean;
var
  a, b, c, HighestCount: Integer;
  arRoughBankCoords, HighestArray: TPointArray;
  arBankCoords: array of TPointArray;
  WeGotIt: Boolean;
begin
  ColorToleranceSpeed(0);
  FindColorsTolerance(arRoughBankCoords, 195836, MMX1, MMY1 + 40, MMX2, MMY2, 5);
  for a := 0 to GetArrayLength(arRoughBankCoords) - 1 do
  begin
    WeGotIt := False;
    for b := 0 to GetArrayLength(arBankCoords) - 1 do
    begin
      for c := 0 to GetArrayLength(arBankCoords[b]) - 1 do
      begin
        if(arRoughBankCoords[a].y > arBankCoords[b][c].y - 5)and
          (arRoughBankCoords[a].y < arBankCoords[b][c].y + 5)then
        begin
          SetArrayLength(arBankCoords[b], GetArrayLength(arBankCoords[b]) + 1);
          arBankCoords[b][GetArrayLength(arBankCoords[b]) - 1] := arRoughBankCoords[a];
          WeGotIt := True;
          Break;
        end;
      end;
    end;
    if not(WeGotIt)then
    begin
      SetArrayLength(arBankCoords, GetArrayLength(arBankCoords) + 1);
      SetArrayLength(arBankCoords[GetArrayLength(arBankCoords) - 1], GetArrayLength(arBankCoords[GetArrayLength(arBankCoords) - 1]) + 1);
      arBankCoords[GetArrayLength(arBankCoords) - 1][0] := arRoughBankCoords[a];
    end;
  end;
  for a := 0 to GetArrayLength(arBankCoords) - 1 do
  begin
    if(GetArrayLength(arBankCoords[a]) > HighestCount)then
    begin
      HighestArray := arBankCoords[a];
      HighestCount := GetArrayLength(arBankCoords[a]);
    end;
  end;
  if(GetArrayLength(HighestArray) > 15)then
  begin
    Result := True;
    for a := 0 to GetArrayLength(HighestArray) - 1 do
    begin
      bx := bx + HighestArray[a].x;
      by := by + HighestArray[a].y;
    end;
    bx := bx / GetArrayLength(HighestArray);
    by := (by / GetArrayLength(HighestArray)) - 10;
  end;
  ColorToleranceSpeed(1);
end;

//-----------------------------------------------------------------\\
{                 BankToMine - Walks to the mine                   ||
\\-----------------------------------------------------------------//}
procedure BankToMine;
var
  MaxTime: Integer;
begin
  if not(LoggedIn)then
    Exit;
  if(FalaRoadColor = 0)or(not(FindColor(x, y, FalaRoadColor, MMX1, MMY1, MMX2, MMY2)))then
    FalaRoadColor := SumFindRoadColor(True);
  RadialWalk(FalaRoadColor, 210, 250, 70, 0, -1);
  FFlag(5);
  MarkTime(MaxTime);
  repeat;
    if not(FindColor(x, y, FalaRoadColor, MMX1, MMY1, MMX2, MMY2))then
      FalaRoadColor := SumFindRoadColor(True);
    RadialWalk(FalaRoadColor, 160, 210, 40, 0, -1);
    FFlag(5);
  until((not(FindColor(x, y, FalaRoadColor, MMCX - 20, MMCY + 10, MMX2, MMY2)))and
        (FindColor(x, y, FalaRoadColor, MMX1, MMY1, MMX2, MMY2)))or
        (TimeFromMark(MaxTime) > 90000);
  if(TimeFromMark(MaxTime) > 90000)then
    PlayerLost('timed out (1)');
  if(RoadColor = 0)or(not(FindColor(x, y, RoadColor, MMX1, MMY1, MMX2, MMY2)))then
    RoadColor := SumFindRoadColor(False);
  MarkTime(MaxTime);
  while(not(FindColor(x, y, CopperRockMMColor, MMX1, MMY1, MMX2, MMY2)))and
       (TimeFromMark(MaxTime) < 90000)do
  begin
    if not(RadialRoadWalk(RoadColor, 160, 280, 50, 0, -1))then
      RoadColor := SumFindRoadColor(False);
    FFlag(5);
  end;
  if(TimeFromMark(MaxTime) > 90000)then
    PlayerLost('timed out (2)');
  MouseFindNoFlag(x, y, 0, -1);
  Flag;
  if not(OreColor = CopperColor)then
  begin
    if(MiningSiteColor = 0)then
    begin
      MiningSiteColor := GetSymbolColor(x, y, 'mining site');
      if(MiningSiteColor = 0)then
      begin
        Writeln('MiningSiteColor not found, terminating.');
        TerminateScript;
      end else
        Writeln('MiningSiteColor = '+IntToStr(MiningSiteColor));
    end else
      if not(FindColor(x, y, MiningSiteColor, MMX1, MMY1, MMX2, MMY2))then
      begin
        MouseFindNoFlag(MMCX + 20, MMCY + 20, -1, -1);
        Flag;
        if not(FindColor(x, y, MiningSiteColor, MMX1, MMY1, MMX2, MMY2))then
        begin
          PlayerLost('Couldnt''t find the mine.');
          Exit;
        end;
      end;
    Mouse(x, y, 10, 10, True);
    Flag;
    GoToCorrectSpot;
  end;
end;

//-----------------------------------------------------------------\\
{                 MineToBank - Walks to the bank                   ||
\\-----------------------------------------------------------------//}
procedure MineToBank;
var
  MaxTime, bx, by: Integer;
begin
  if not(LoggedIn)then
    Exit;
  if not(OreColor = CopperColor)then
  begin
    if(MiningSiteColor = 0)then
    begin
      MiningSiteColor := GetSymbolColor(x, y, 'mining site');
    end else
      if(FindColor(x, y, MiningSiteColor, MMX1, MMY1, MMX2, MMY2))then
      begin
        Mouse(x, y, 20, 20, True);
        Flag;
        if(FindColor(x, y, CopperRockMMColor, MMX1, MMY1, MMX2, MMY2))then
        begin
          Mouse(x, y, 3, 3, True);
          Flag;
        end else
          PlayerLost('Failed to find the Copper Rock');
      end else
        PlayerLost('Failed to find the Mining Site Symbol');
  end;
  MarkTime(MaxTime);
  repeat;
    if not(RadialRoadWalk(RoadColor, 340, 450, 70, 0, 2))then
    begin
      Mouse(MMCX, MMCY - 30, 5, 5, True);
      RoadColor := SumFindRoadColor(False);
      RadialRoadWalk(RoadColor, 340, 450, 70, 0, 2);
      Flag;
    end else
      Break;
    FFlag(5);
  until(TimeFromMark(MaxTime) > 30000);
  if(TimeFromMark(MaxTime) > 30000)then
    PlayerLost('timed out (3)');
  FFlag(5);
  MarkTime(MaxTime);
  while((FindColor(x, y, RoadColor, MMX1, MMY1, MMX2, MMCY - 20))or
       (not FindColor(x, y, RoadColor, MMX1, MMY1, MMX2, MMY2)))and
       (TimeFromMark(MaxTime) < 90000)and
       (LoggedIn)do
  begin
    if not(RadialRoadWalk(RoadColor, 355, 495, 50, 0, -1))then
      RoadColor := SumFindRoadColor(False);
    FFlag(5);
  end;
  if(TimeFromMark(MaxTime) > 90000)then
    PlayerLost('timed out (4)');
  MarkTime(MaxTime);
  repeat;
    if not(RadialWalk(FalaRoadColor, 330, 380, 40, 0, -1))then
    begin
      FalaRoadColor := SumFindRoadColor(True);
      RadialWalk(FalaRoadColor, 0, 70, 40, -1, 0);
    end;
    Flag;
    Wait(200+Random(200));
  until(SumFindBank(bx, by))and
       (not(FindColor(x, y, RoadColor, MMX1, MMY1, MMX2, MMY2)))or
       (TimeFromMark(MaxTime) > 90000);
  Mouse(bx, by, 3, 3, True);
  if(TimeFromMark(MaxTime) > 90000)then
    PlayerLost('timed out (5)');
  Flag;
  if(FindDtmRotated(dtmBanker, x, y, MMX1, MMY1, MMX2, MMY2, 0, pi*2, 0.1, AngleVar))then
  begin
    MouseFindNoFlag(x, y, 1, 0);
    Flag;
    if(FlagPresent)then
      Wait(500 + Random(200));
  end;
end;

//------------------------------------------------------------------------\\
{             GetBestPaxe - Finds the best paxe in the bank               ||
\\------------------------------------------------------------------------//}
function GetBestPaxe(var x, y : integer) : Boolean;
var
  I : integer;
begin
  FixBank;
  for I := 1 to 7 do
  begin
    if(I = 7)then
      Break;
    if(FindDtm(dtmPaxes[I], x, y, MSX1, MSY1, MSX2, MSY2))then
    begin
      Result := True;
      Break;
    end;
  end;
  if(I = 7)then
  begin
    CloseBank;
    PlayerLost('No Paxe in the bank');
  end;
end;

//------------------------------------------------------------------------\\
{           SLOpenBank - Opens the bank, thnx to Lorax, made by me        ||
\\------------------------------------------------------------------------//}
function SLOpenBank: Boolean;
var
  BankTime, I: Integer;
  arBankColor, arBankColorResults: TPointArray;
begin
  if LoggedIn then
  begin
    Wait(500);
    MarkTime(BankTime);
    while(not(BankScreen))and(TimeFromMark(BankTime) < 20000)do
    begin
      FindColorsSpiralTolerance(MSCX, MSCY, arBankColor, 4679037, MSX1, MSCY, MSX2, MSY2, 10);
      if(GetArrayLength(arBankColor) = 0)then
        Break;
      arBankColorResults := getArrayFromBox(arBankColor, 40, 40);
      for I := 1 to GetArrayLength(arBankColorResults)-1 do
      begin
        if not(LoggedIn)then Exit;
        Flag;
        Wait(100 + Random(100));
        MMouse(arBankColorResults[I].x, arBankColorResults[I].y, 5, 5);
        if(IsUpTextMulti('se Ban', 'ank b', 'booth'))then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 2, 2, false);
          Wait(100+Random(100));
          ChooseOption(x, y, 'uickly');
          Wait(100+Random(100));
          Flag;
          Wait(1000 + Random(500));
        end;
        if(PinScreen)then
          if not(InPin(PinNumber))then
            Writeln('Pin Failed.');
        if(BankScreen)or(TimeFromMark(BankTime) > 20000)then
          Break;
      end;
    end;
    Result := BankScreen;
  end;
end;

//------------------------------------------------------------------------\\
{                     SLBank - Main banking procedure                     ||
\\------------------------------------------------------------------------//}
procedure SLBank(WithdrawNewPick: Boolean);
var
  dtmOre: Integer;
begin
  if LoggedIn then
  begin
    if(WithdrawNewPick)then
    begin
      if(InvCount = 28)then
      begin
        dtmOre := DTMFromString('78DA63DCCBC0C0F08C0105989828C1D9FF818' +
       '0711D90F198010D302291407A0F90F84C40CD29207197809AE340' +
       'E2157E3500FA360CCF');
        if(FindDtm(dtmOre, x, y, MIX1, MIY1, MIX2, MIY2))then
        begin
          Mouse(x, y, 5, 5, false);
          ChooseOption(x, y, 'rop');
        end;
        FreeDtm(dtmOre);
      end;
      GameTab(5);
      Mouse(591, 304, 10, 10, true);
      GameTab(4);
    end;
    SLOpenBank;
    if(not BankScreen)then
    begin
      if(FindDtmRotated(dtmBanker, x, y, MMX1, MMY1, MMX2, MMY2, 0, pi*2, 0.1, AngleVar))then
      begin
        MouseFindNoFlag(x, y, 1, 0);
        Flag;
        if(FlagPresent)then
          Wait(500 + Random(200));
      end;
      if not(OpenBankQuiet('feb'))then
      begin
        Wait(500);
        if not(BankScreen)then
        begin
          PlayerLost('couldnt open the bank.');
          Exit;
        end;
      end;
    end;
    FixBank;
    if(EquipPick)or(WithdrawNewPick)then
    begin
      DepositAll;
      DepositAll;
    end else
      Deposit(2, 28, 2);
    if(WithdrawNewPick)then
    begin
      if(GetBestPAxe(x, y))then
      begin
        Mouse(x, y, 5, 5, true);
        Wait(200+Random(300));
      end;
    end;
    CloseBank;
    Wait(200+Random(200));
    if(BankScreen)then
      CloseBank;
    if(WithdrawNewPick)then
    begin
      if(FindColorTolerance(x, y, 876930, MIX1, MIY1, MIX2, MIY2, 10))then
        Mouse(x, y, 4, 4, True);
      Wait(400 + Random(400));
      if not(SumFindPickHeadColor)then
        PlayerLost('You dont have an axe');
    end;
  end;
end;

//-----------------------------------------------------------------\\
{       TimeToSwitchPlayers - Is it time to switch players ?       ||
\\-----------------------------------------------------------------//}
function TimeToSwitchPlayers: boolean;
begin
  if(TimeFromMark(RunTime) / 60 / 1000 > MinutesPerPlayer)then
  begin
    Result := True;
    WriteLn('Time is up');
  end else
    Result := False;
end;

//-----------------------------------------------------------------\\
{                    Signature - My trade mark :)                  ||
\\-----------------------------------------------------------------//}
procedure Signature;
begin
  Writeln('  _______              __ __ __');
  Writeln(' / _____/__ __  _____ |__|  |__| ___  ____');
  Writeln(' \___  \|  |  \/     \|  |  |  |/ _ \/    \');
  Writeln(' /      \  |  /  Y Y  \  |  |  ( <_> )  |  \');
  Writeln('/_____  /____/|__|_|  /__|__|__|\___/|__|  /');
  Writeln('      \/            \/                   \/');
  Writeln('Scripts Brings You:');
  Writeln('         Sumilions Rimmington Miner');
end;

//-----------------------------------------------------------------\\
{                SetupScript - Sets up the script.                 ||
\\-----------------------------------------------------------------//}
procedure SetupScript;
begin
  SetupSRL;
  SetupSRLMining;
  ScriptID := '166';
  RCMaster := RemoteMaster;
  if(SRLStatsID <> '')then
    SRLID := SRLStatsID;
  if(SRLStatsPW <> '')then
    SRLPassword := SRLStatsPW;
  LoadImages;
  DeclarePlayers;
  MinCount := TheMinCount;
  BenMouse := UseBenMouse;
  CurrentPlayer := StartPlayer;
  ClearDebug;
  Signature;
  CheckUserNicks;
  Wait(500);
  ActivateClient;
  Wait(500);
end;

//-----------------------------------------------------------------\\
{               SetupUser - Sets up the current user.              ||
\\-----------------------------------------------------------------//}
procedure SetupUser;
begin
  if not(LoggedIn)then
    LoginPlayer;
  MakeCompass('N');
  HighestAngle;
  if not(SumFindPickHeadColor)then
  begin
    Writeln('No PickAxe found...');
    Writeln('Make sure your at V-Bright');
    LogOut;
  end;
  GameTab(2);
  Players[CurrentPlayer].Level[15] := GetSkillLevel('mining');
  PinNumber := Players[CurrentPlayer].String2;
  SetOreColor;
  GameTab(4);
  MarkTime(RunTime);
end;

//-----------------------------------------------------------------\\
{                MainLine - The magic is down here.                ||
\\-----------------------------------------------------------------//}
begin
  SetupScript;
  repeat;
    SetupUser;
    repeat;
      BankToMine;
      SetRun(True);
      while(LoggedIn)and
           (not(InvFull))and
           (not(TimeToSwitchPlayers))do
      begin
        if not(SumMine)then
          if(Random(100) > 85)then
            IdleTime(500, 500, 0.4);
        Wait(16);
        FindNormalRandoms;
        Wait(16);
      end;
      SetRun(False);
      GameTab(4);
      MineToBank;
      KeepUpStats;
      SLBank(False);
      PlayerStatus := LoggedIn;
      if(TimeToSwitchPlayers)then
        LogOut;
    until not(LoggedIn);
    NextPlayer(PlayerStatus);
  until not(Players[CurrentPlayer].Active);
  Writeln('All players are false.');
end.

It says
Line 31: [Error] (83:1): Duplicate identifier '' in script C:\Program Files\SCAR 3.11\includes\SRL/SRL/Core/Globals.scar

And opens up a new tab with Globals.scar saying
Code:
//-----------------------------------------------------------------//
//--               Scar Standard Resource Library                --//
//--               » Global Variables                            --//
//-----------------------------------------------------------------//
// * procedure LoadSRLBitMaps;                   // * by SRL Dev Team
// * procedure FreeSRLBitMaps;                   // * by Ron

{ const SRLVersionNumber;
  Description: Repository Version Number. }
const
  SRLVersionNumber = '4.00';


{ var bmpAdmin, bmpMod, Lamp, Box: Integer;
  Description: Global Bitmaps. Need to be Global because of SCAR Memory leaks. }
var
  bmpAdmin, bmpMod, Lamp, Box: Integer;

{ var RoadColor, WaterColor, BankColor: Integer;
  Description: Three variables you will almost always use. :) }
var
  RoadColor, WaterColor, BankColor: Integer;

{ var LampSkill: String;
  Description: Set Lamp skill. }
var
  LampSkill: string;

{ const MMX1, MMY1, MMX2, MMY2;
  Description: MiniMap Edge Points. }
const
  MMX1 = 570;
  MMY1 = 5;
  MMX2 = 715;
  MMY2 = 160;

{ const MMCX, MMCY;
  Description: MiniMap Centre Point. }
const
  MMCX = 643;
  MMCY = 84;

{ const MSX1, MSY1, MSX2, MSY2;
  Description: Main Screen EdgePoints. }
const
  MSX1 = 1;
  MSY1 = 1;
  MSX2 = 516;
  MSY2 = 338;

{ const MSCX, MSCY;
  Description: Main Screen Centre Points. }
const
  MSCX = 259;
  MSCY = 170;

{ const MIX1, MIY1, MIX2, MIY2;
  Description: Inventory EdgePoints. }
const
  MIX1 = 547;
  MIY1 = 202;
  MIX2 = 737;
  MIY2 = 466;

{ const MICX, MICY;
  Description: Inventory Centre Points. }
const
  MICX = 642;
  MICY = 334;

{ const MCX1, MCY1, MCX2, MCY2;
  Description: Chat Screen EdgePoints. }
const
  MCX1 = 4;
  MCY1 = 342;
  MCX2 = 496;
  MCY2 = 460;

{ const MCCX, MCCY;
  Description: Chat Screen Centre Points. }
const
  MCCX = 250;
  MCCY = 401;

//****************************************************************************//
// * I tried to make these Bitmaps Local, but I got after a couple of hours
// *  running scripts, CTB and DB handle errors. So sorry, declared them global
//****************************************************************************//

{*******************************************************************************
procedure LoadSRLBitMaps;
By: SRL Dev Team
Description: Loads SRL Bitmaps into memory.
*******************************************************************************}

procedure LoadSRLBitMaps;
begin
  bmpMod := BitmapFromString(9, 6, 'z78DA733472A41B74350041' +
    '08DB0009E012B13407414C5DF8D994E8220F0200F59E4633');
  bmpAdmin := BitmapFromString(9, 6, 'z78DA7333777333B070A3' +
    '0F0904162610B60112C025E26266E96A6488A90B3F9B125DE4910' +
    '0A83249DE');
  Lamp := BitmapFromString2(False, 'aE3F5378DA558D4B0E8030084' +
       '4AFC4670A75D98ABDFF912C5693BA7921330F20226A7582CA3901' +
       'C9B9E04A0E9B34C9522A32799C3D2F9489394FBA46D23367CD0BE' +
       'CA83637C39B1F1FF9E4DC79ACC5B7957925B4E9F16FBB7666D865' +
       '418181415542E2739484E49DCDCDA8C250A8EE5F96530C01D92FE' +
       'FEDEEECC9AF059AF6E5DCE2E');
  Box := BitmapFromString(6, 6, 'z78DA33300001373030C00B8851' +
       '439E4A646040250000B06A2B99');
end;

//* Users
 {var FileName: String;
  Description: Filename to save and load users from. }
var
  FileName: string;


{*******************************************************************************
procedure FreeSRLBitMaps;
By: Ron
Description: Frees SRL Bitmaps into memory.
*******************************************************************************}

procedure FreeSRLBitmaps;
begin
  FreeBitmap(bmpMod);
  FreeBitmap(bmpAdmin);
  FreeBitmap(Lamp);
  FreeBitmap(Box);
end;

How do I fix this as it happens whenever I want to auto...
 
I have SCAR 3.11 at the moment and I tried to download SCAR 3.12 but it says the setup files are corrupt please download file again every time I download it. Both the mirror sites have old versions.

Where can I download it?
 
Thats a nice script... props to the guy who wrote it... well laid out and simple to read
 
Of course it's good Sumilion wrote it but my problem is that I can't get SCAR 3.12 and when I download SRL and includes through SCAR 3.11 I still get the same error when I run scripts.
 
I wasn't using the mirrors before but I followed your link and I got SCAR312.exe application is not a valid win32 file when I try to open it.
 
may u can use scar312.exe its ah god program
 
Runescape Gamblingrunescape gambling
Back
Top