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

[SRL] Magic Johnson's Rock Smasher [SRL]

Joined
Mar 6, 2007
Sythe Gold
0
Messages
504
Location
Behind You
I have been working on this power miner for a while now. It has very few bugs. First release, let me know what you think.

{.Script Info:
# ScriptName = Magic Johnson's Rock Smasher
# Author = Magic Johnson
# Description = An awesome powerminer
# Version = 0.01
/Script Info}

program RockSmasher;
{.include srl/srl.scar}
{.include srl/srl/skill/mining.scar}
{.include SRL\SRL\Misc\Trade.scar}

{Setup lines 16 - 28 and Players Array is lines 163 - 165}

const
HMD = 10000; // How many loads to mine then drop
mins = 15; // Log out every how many mins?
forxmins = 3; // Stay logged out for how many mins?
ranmins = 10; // Random mins to be added to mins
ranlmins = 3; // Random mins to be added to forxmins
RunDirection = 'N'; // Run away direction
Rockname = 'Copper'; // The name of the rock you are mining
UAB = 'Yes'; // Use AntiBan, Yes or No
Startplayer = 0; // Player that starts
Tolerance = 3; // Tolerance for the monster colours
waittime = 2; // How long in seconds do you want to wait inbetween clicking on each rock
range = 725; // A random number, between 500 and 1000

//---------------------------Do not touch below---------------------------\\

var
Mvar, Mlvl, Color1, Color2, Color3, Min3d, LoadCount, SkillTimer, TabTimer, ab, z:integer;
Dx, Dy, Gasses, exp, xp, TotalOres, TotalXP:integer;

procedure OrezColorz;
begin
Mvar := -1;
exp := 0;
a := 0;
TotalOres := 0;
LoadCount := 0;
if (RockName = 'Tin') then
begin
Color1 := 8421514;
Color2 := 7960962;
Color3 := 5000274;
exp := 17;
end
if (RockName = 'Copper') then
begin
Color1 := 8618893;
Color2 := 4483988;
Color3 := 4417422;
exp := 17;
end
if (RockName = 'Iron') then
begin
Color1 := 1317933;
Color2 := 2305870;
Color3 := 1844542;
exp := 35;
end
end;

procedure report;
begin
TotalXP := TotalOres * exp;
SRLRandomsReport;
if (Mvar = -1) then
begin
GetSkillLevel('Mining');
Mlvl := GetSkillLevel('Mining');
end
writeln('+-----------------------------------------------]');
writeln('| Magic Johnson'#39' Rock Smasher');
writeln('| Worked for '+ TimeRunning);
writeln('| Mined and dropped ' + IntToStr(TotalOres) + ' ' + RockName + ' ores');
writeln('| Gained ' + IntToStr(totalxp) + ' mining xp');
writeln('| Your mining level is now ' + IntToStr(Mlvl));
writeln('| Avoided Gas ' + IntToStr(Gasses) + ' times');
writeln('+-----------------------------------------------]');
end;

Function LogOutEveryM(mins, forxmins: Integer):Boolean;
var
Mark: Integer;
begin
if ((TimeFromMark(LogOutMark) / 1000) / 60 >= mins) then
begin
MarkTime(LogOutMark);
MMouse(Random(500), -10, 0, 0)
Logout;
WriteLn('Logging out and coming back in about ' + IntToStr(forxmins) +
' min(s)');
MarkTime(Mark);
repeat
MMouse(0, 0, 100, 100)
Wait(90000 + Random(1000));
Wait(15 + Random(15) + Random(15))
until (TimeFromMark(Mark) >= forxmins);
Wait(Random(30000) + Random(30000));
LoginPlayer;
Wait(Random(15000) + Random(15000));
end;
end;

procedure ranz;
begin
GetMousePos(Dx, Dy);
OreColor := GetColor(Dx, Dy);
If FindGas(Dx, Dy - 20) Then
Begin
FTWait(40);
Gasses := Gasses + +1;
ReportVars[3] := ReportVars[3] + 1;
WriteLn('Gas Found.');
Exit;
End;
SetScreenName(Players[0].Name);
Findtalk;
if (FindTalk = true) then
begin
SolveTalkingRandom('Talk to');
end
FindNormalRandoms;
FindFight;
if (FindFight = true) then
begin
RunWhere(RunDirection, true);
end
FindPick;
LogOutEveryM(mins + random(ranmins), forxmins+random(ranlmins));
if (NoPick = True) then
begin
writeln('The script failed to avoid gas... Logging out');
LogOut;
NextPlayer(True);
end
if (not(LoggedIn)) then
begin
NextPlayer(True);
end
end;

procedure RandomTab;
begin
MarkTime(TabTimer);
repeat
if TimeFromMark(TabTimer) > 2000 then
begin
ranz;
Wait(600+random(500))
Gametab(1+random(12))
MarkTime(Tabtimer);
end else Wait(500);
until false;
end;

procedure SkillCheck;
begin
z := random(3);
if z = 0 then
begin
ranz;
writeln('Checking skill... Mining');
HoverSkill('Mining',false);
GetSkillLevel('Mining');
Mlvl := GetSkillLevel('Mining');
end
if z = 1 then
begin
ranz;
writeln('Checking skill... Smithing');
HoverSkill('Smithing',false);
end
if z = 2 then
begin
ranz;
writeln('Checking skills... Mining & Smithing');
HoverSkill('Mining',false);
wait(1000 + random(500));
HoverSkill('Smithing',false);
end
end;

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(howmanyplayers);
CurrentPlayer := StartPlayer;

Players[0].Name :='user'; // Name
Players[0].Pass :='pass'; // Pass
Players[0].Nick := 'nik'; // About 3 letters of ur name
Players[0].Active := True;

writeln('Using '+inttostr(howmanyplayers)+' player');
end;

function FindDatRok(Color1, Color2, Color3, Tolerance: Integer; RockName: String): Boolean;
var
i, x, y: Integer;
begin
FFlag(5);
for i:= 1 to 5 do
begin
if(FindColorTolerance(x, y, Color1, MSX1, MSY1, MSX2, MSY2, Tolerance + i))and
(FindColorTolerance(x, y, Color2, MSX1, MSY1, MSX2, MSY2, Tolerance + i))and
(FindColorTolerance(x, y, Color3, MSX1, MSY1, MSX2, MSY2, Tolerance + i))then
begin
MMouse(x, y, 3, 3);
wait(80 + random(60));
if(IsUpText('Mine Rocks'))then
begin
result := true;
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
wait(40 + random(20));
FFlag(5);
wait((waittime*1000)+random(range));
exit;
end;
end;
end;
end;

procedure MineDemRox;
begin
Repeat;
Mvar := Mvar + 1;
MarkTime(TabTimer);
MarkTime(SkillTimer);
ranz;
FindDatRok(Color1, Color2, Color3, Tolerance, RockName);
Report;
ranz;
wait(1000+Random(550));
if TimeFromMark(SkillTimer) > 30000 then
begin
Wait(1000+random(500))
SkillCheck;
End;

if TimeFromMark(TabTimer) > 25000 then
begin
Wait(1000+random(500))
Gametab(1+random(12))
end;

If (InvFull = true) then
begin
ranz;
TotalOres := TotalOres + 28;
DropAll;
ranz;
end

ranz;

if (UAB = 'Yes') then
begin
AntiBan;
end

until(LoadCount >= HMD);
end;

begin
OrezColorz;
ClearDebug;
SetupSRL;
SetupSRLMining;
LoadMiningBitMaps;
Declareplayers;
loginplayer;
FindPickHeadColor;
MineDemRox;
Logout;
end.
 
I doubt u made this... But if u did u should put indents to it and wrap code tags around the text... Oh well, i put indents to it for u.. I can remove this if u want, its just easier to read when theres some spaces too :p .. I used a pascal formatter for the indents.

Code:
{.Script Info:
# ScriptName = Magic Johnson's Rock Smasher
# Author = Magic Johnson
# Description = An awesome powerminer
# Version = 0.01
/Script Info}

program RockSmasher;
{.include srl/srl.scar}
{.include srl/srl/skill/mining.scar}
{.include SRL\SRL\Misc\Trade.scar}

{Setup lines 16 - 28 and Players Array is lines 163 - 165}

const
  HMD = 10000; // How many loads to mine then drop
  mins = 15; // Log out every how many mins?
  forxmins = 3; // Stay logged out for how many mins?
  ranmins = 10; // Random mins to be added to mins
  ranlmins = 3; // Random mins to be added to forxmins
  RunDirection = 'N'; // Run away direction
  Rockname = 'Copper'; // The name of the rock you are mining
  UAB = 'Yes'; // Use AntiBan, Yes or No
  Startplayer = 0; // Player that starts
  Tolerance = 3; // Tolerance for the monster colours
  waittime = 2;
    // How long in seconds do you want to wait inbetween clicking on each rock
  range = 725; // A random number, between 500 and 1000

  //---------------------------Do not touch below---------------------------\\

var
  Mvar, Mlvl, Color1, Color2, Color3, Min3d, LoadCount, SkillTimer, TabTimer,
    ab, z: integer;
  Dx, Dy, Gasses, exp, xp, TotalOres, TotalXP: integer;

procedure OrezColorz;
begin
  Mvar := -1;
  exp := 0;
  a := 0;
  TotalOres := 0;
  LoadCount := 0;
  if (RockName = 'Tin') then
  begin
    Color1 := 8421514;
    Color2 := 7960962;
    Color3 := 5000274;
    exp := 17;
  end
    if (RockName = 'Copper') then
    begin
      Color1 := 8618893;
      Color2 := 4483988;
      Color3 := 4417422;
      exp := 17;
    end
      if (RockName = 'Iron') then
      begin
        Color1 := 1317933;
        Color2 := 2305870;
        Color3 := 1844542;
        exp := 35;
      end
end;

procedure report;
begin
  TotalXP := TotalOres * exp;
  SRLRandomsReport;
  if (Mvar = -1) then
  begin
    GetSkillLevel('Mining');
    Mlvl := GetSkillLevel('Mining');
  end
    writeln('+-----------------------------------------------]');
  writeln('| Magic Johnson'#39' Rock Smasher');
  writeln('| Worked for ' + TimeRunning);
  writeln('| Mined and dropped ' + IntToStr(TotalOres) + ' ' + RockName +
    ' ores');
  writeln('| Gained ' + IntToStr(totalxp) + ' mining xp');
  writeln('| Your mining level is now ' + IntToStr(Mlvl));
  writeln('| Avoided Gas ' + IntToStr(Gasses) + ' times');
  writeln('+-----------------------------------------------]');
end;

function LogOutEveryM(mins, forxmins: Integer): Boolean;
var
  Mark: Integer;
begin
  if ((TimeFromMark(LogOutMark) / 1000) / 60 >= mins) then
  begin
    MarkTime(LogOutMark);
    MMouse(Random(500), -10, 0, 0)
      Logout;
    WriteLn('Logging out and coming back in about ' + IntToStr(forxmins) +
      ' min(s)');
    MarkTime(Mark);
    repeat
      MMouse(0, 0, 100, 100)
        Wait(90000 + Random(1000));
      Wait(15 + Random(15) + Random(15))
    until (TimeFromMark(Mark) >= forxmins);
    Wait(Random(30000) + Random(30000));
    LoginPlayer;
    Wait(Random(15000) + Random(15000));
  end;
end;

procedure ranz;
begin
  GetMousePos(Dx, Dy);
  OreColor := GetColor(Dx, Dy);
  if FindGas(Dx, Dy - 20) then
  begin
    FTWait(40);
    Gasses := Gasses + +1;
    ReportVars[3] := ReportVars[3] + 1;
    WriteLn('Gas Found.');
    Exit;
  end;
  SetScreenName(Players[0].Name);
  Findtalk;
  if (FindTalk = true) then
  begin
    SolveTalkingRandom('Talk to');
  end
    FindNormalRandoms;
  FindFight;
  if (FindFight = true) then
  begin
    RunWhere(RunDirection, true);
  end
    FindPick;
  LogOutEveryM(mins + random(ranmins), forxmins + random(ranlmins));
  if (NoPick = True) then
  begin
    writeln('The script failed to avoid gas... Logging out');
    LogOut;
    NextPlayer(True);
  end
    if (not (LoggedIn)) then
    begin
      NextPlayer(True);
    end
end;

procedure RandomTab;
begin
  MarkTime(TabTimer);
  repeat
    if TimeFromMark(TabTimer) > 2000 then
    begin
      ranz;
      Wait(600 + random(500))
        Gametab(1 + random(12))
        MarkTime(Tabtimer);
    end
    else
      Wait(500);
  until false;
end;

procedure SkillCheck;
begin
  z := random(3);
  if z = 0 then
  begin
    ranz;
    writeln('Checking skill... Mining');
    HoverSkill('Mining', false);
    GetSkillLevel('Mining');
    Mlvl := GetSkillLevel('Mining');
  end
    if z = 1 then
    begin
      ranz;
      writeln('Checking skill... Smithing');
      HoverSkill('Smithing', false);
    end
      if z = 2 then
      begin
        ranz;
        writeln('Checking skills... Mining & Smithing');
        HoverSkill('Mining', false);
        wait(1000 + random(500));
        HoverSkill('Smithing', false);
      end
end;

procedure DeclarePlayers;
begin

  HowManyPlayers := 1;
  NumberOfPlayers(howmanyplayers);
  CurrentPlayer := StartPlayer;

  Players[0].Name := 'user'; // Name
  Players[0].Pass := 'pass'; // Pass
  Players[0].Nick := 'nik'; // About 3 letters of ur name
  Players[0].Active := True;

  writeln('Using ' + inttostr(howmanyplayers) + ' player[s]');
end;

function FindDatRok(Color1, Color2, Color3, Tolerance: Integer; RockName:
  string): Boolean;
var
  i, x, y: Integer;
begin
  FFlag(5);
  for i := 1 to 5 do
  begin
    if (FindColorTolerance(x, y, Color1, MSX1, MSY1, MSX2, MSY2, Tolerance + i))
      and
      (FindColorTolerance(x, y, Color2, MSX1, MSY1, MSX2, MSY2, Tolerance + i))
        and
      (FindColorTolerance(x, y, Color3, MSX1, MSY1, MSX2, MSY2, Tolerance + i))
        then
    begin
      MMouse(x, y, 3, 3);
      wait(80 + random(60));
      if (IsUpText('Mine Rocks')) then
      begin
        result := true;
        GetMousePos(x, y);
        Mouse(x, y, 0, 0, true);
        wait(40 + random(20));
        FFlag(5);
        wait((waittime * 1000) + random(range));
        exit;
      end;
    end;
  end;
end;

procedure MineDemRox;
begin
  repeat;
    Mvar := Mvar + 1;
    MarkTime(TabTimer);
    MarkTime(SkillTimer);
    ranz;
    FindDatRok(Color1, Color2, Color3, Tolerance, RockName);
    Report;
    ranz;
    wait(1000 + Random(550));
    if TimeFromMark(SkillTimer) > 30000 then
    begin
      Wait(1000 + random(500))
        SkillCheck;
    end;

    if TimeFromMark(TabTimer) > 25000 then
    begin
      Wait(1000 + random(500))
        Gametab(1 + random(12))
    end;

    if (InvFull = true) then
    begin
      ranz;
      TotalOres := TotalOres + 28;
      DropAll;
      ranz;
    end

      ranz;

    if (UAB = 'Yes') then
    begin
      AntiBan;
    end

  until (LoadCount >= HMD);
end;

begin
  OrezColorz;
  ClearDebug;
  SetupSRL;
  SetupSRLMining;
  LoadMiningBitMaps;
  Declareplayers;
  loginplayer;
  FindPickHeadColor;
  MineDemRox;
  Logout;
end.
 
Umm, The declare players should be the first procedure so its easier to find.
instead of huge const, add things like the staying logged out times to the player
variables .
Feel free to look from my clarion v0.5

If its ur first, it rocks.
 
It's like a quote, except it is used for coding. I see no reason why this couldn't be your script and I see no reason to assume that it is not, it is nice to see a new scripter in the comminity.
 
Well... He had 1 post and didnt know how to use code tags.. And town, has ur cutter been verified?
 
hey umm i run the script in scar and it says ... Running Script. but my guy doesnt do anything does anybody know why
 
Back
Top