SCAR Code:
{.Script Info:
# ScriptName = RiddareRalf's Powerminer
# Author = RiddareRalf [RiddareRalf@gmail.com]
# Description = This is a powerminer for RS2 using SRL.
Please fill in all the required info below.
# Version = 0.20 (for Scar 2.03 and SRL version 3.6)
# Date = 20.05.2007
# Comments = Under development...
/Script Info}
{If you would like to share this script to other
sources then please ask me first. }
{Also, please post a comment or progress at:
http://www.villavu.com/forum/showthread.php?t=10341}
{=========================================================================]
| Description: |
| This is a script that will powermine almost any ore for yo. |
| Instructions: |
| 1.Use a 32bit resolution and set your RS brightness to very bright. |
| 2.The script is suited for Scar 2.03 using SRL. |
| 3.Start next to mining rocks. |
| 4.have the pickaxe wielded or in the inventory slot, remember to |
| adapt the constant "PickWielded" to your settings. |
| 5.Please fill in ALL the necessary info below or the script won't |
| work correctly. |
[=========================================================================}
program RalfsPowerMiner;
{.include srl/srl.scar}
{.include srl/srl/skill/Mining.scar}
{.include SRL/SRL/Misc/Trade.scar}
{.include srl/srl/skill/Fighting.scar}
//==============================[Setup]===================================\\
const
// Script Setup
ThisVersion = '0.20'; // The current version of this script
DownloadNewsVar = True; // If it should download the latest news
CheckForUpdates = True; // If it should look and download updates
UseAntiBan = True; // You know what this is...
// Player Setup
StartPlayer = 0; // The player to start with
AmountOfPlayers = 1; // Change this to the amount of characters
MiningWait = 2; // Max time to wait before taking next ore (Seconds)
PickWielded = False; // Is your pickaxe wielded?
HowManyLoads = 10; // The number of loads to do
RunningDir = 'N'; // Direction to run if you get attacked
RunFar = True; // Run far if being attacked?
OreTolerance = 2; // Change this if you know what it is
// Ore colors
ClayColor=3764366; // If ore isn't found then change this value
CopperColor=5870567; // If ore isn't found then change this value
TinColor=9013652; // If ore isn't found then change this value
IronColor=2305869; // If ore isn't found then change this value
SilverColor=10921650; // If ore isn't found then change this value
CoalColor=2438711; // If ore isn't found then change this value
GoldColor=2016753; // If ore isn't found then change this value
MithrilColor=7425100; // If ore isn't found then change this value
AdamantiteColor=6717286;// If ore isn't found then change this value
RuniteColor=0; // To come but who do even powermine runite?
var
OreDTM, LoadsDone, OreToMineColor : Integer;
OresMined : Integer;
Experience, ExpValue : Extended;
//===========================[Player Setup]================================\\
procedure DeclarePlayers;
begin
HowManyPlayers := 6; // Don't edit this one
CurrentPlayer := StartPlayer;
NumberOfPlayers(HowManyPlayers);
Players[0].Name :='Username';
Players[0].Pass :='Password';
Players[0].Nick :='ass'; // 3-4 letters from your name. No CAPS
// Names: Clay, Copper, Tin, Iron, Silver, Gold, Mith, Addy)
Players[0].String1 :='Iron'; // What do you want to mine?
Players[0].Active:= True;
Players[1].Name :='Username';
Players[1].Pass :='Password';
Players[1].Nick :='ssw';
Players[1].String1 :='Copper';
Players[1].Active:= False; // Be sure to change this if you are using multiple players
Players[2].Name :='Username';
Players[2].Pass :='Password';
Players[2].Nick :='ssw';
Players[2].String1 :='copper';
Players[2].Active:= False;
Players[3].Name :='Username';
Players[3].Pass :='Password';
Players[3].Nick :='ssw';
Players[3].String1 :='Copper';
Players[3].Active:= False;
Players[4].Name :='Username';
Players[4].Pass :='Password';
Players[4].Nick :='ssw';
Players[4].String1 :='Copper';
Players[4].Active:= False;
Players[5].Name :='Username';
Players[5].Pass :='Password';
Players[5].Nick :='ssw';
Players[5].String1 :='Copper';
Players[5].Active:= False;
end;
//======================================================================\\
// My Signature \\
//======================================================================\\
procedure Signature;
begin
Writeln('______ _ _ _ ______ _ __' );
Writeln('| ___ (_) | | | | | ___ \ | |/ _|');
Writeln('| |_/ /_ __| | __| | __ _ _ __ ___| |_/ /__ _| | |' );
Writeln('| /| |/ _` |/ _` |/ _` | |__/ _ \ // _` | | _|');
Writeln('| |\ \| | (_| | (_| | (_| | | | __/ |\ \ (_| | | |' );
Writeln('\_| \_|_|\__,_|\__,_|\__,_|_| \___\_| \_\__,_|_|_|' );
Writeln('RiddareRalf provides you with:');
Writeln(' RiddareRalfs Powerminer');
end;
//======================================================================\\
// Progress Report \\
//======================================================================\\
procedure ProgressReport;
begin
SRLRandomsReport;
Writeln('==========================================');
Writeln(' RiddareRalfs Progress Report:');
Writeln('');
Writeln(' Name: ' + Players[CurrentPlayer].Name);
Writeln(' Ores mined: ' + IntToStr(OresMined));
Writeln(' Experience: ' + FloatToStr(Experience));
Writeln(' Loads done: ' + IntToStr(LoadsDone));
Writeln(' Worked for: ' + ScriptTime2(1));
Writeln('==========================================');
end;
//======================================================================\\
// CheckVersion Script (Idea taken from Sumilion) \\
//======================================================================\\
procedure CheckVersion;
var
TheFileNumber: Integer;
CurrentVersion: Extended;
TheScriptString, ScriptName, CurrentVersionString : string;
begin
CurrentVersionString := GetPage('http://www.wiileague.org/RS/currentversion.txt');
CurrentVersion := StrToFloat(CurrentVersionString);
if(CurrentVersion > StrToFloat(ThisVersion)) then
begin
Cleardebug;
Writeln('Attention!');
Writeln('');
Writeln('There is a new version available!');
Writeln('Downloading the latest version...');
TheScriptString := GetPage('http://www.wiileague.org/RS/powerminer.txt');
ScriptName := 'RiddareRalfs Powerminer v' + CurrentVersionString + '.scar';
TheFileNumber := ReWriteFile(ScriptPath + ScriptName, false);
WriteFileString(TheFileNumber, TheScriptString);
Writeln('The script has now been downloaded!');
Writeln('You can find the script at: ' + ScriptPath + ScriptName);
TerminateScript;
end;
end;
//======================================================================\\
// News Script (Idea taken from Sumilion) \\
//======================================================================\\
procedure DownloadNews;
var
Timer, x : Integer;
New, TheNews, Temp : string;
begin
Status('The news is being downloaded...');
Wait(1);
x := 0;
TheNews := Getpage('http://www.wiileague.org/RS/thenews.txt');
AddToReport('[==========================]');
AddToReport(' RiddareRalf News (V ' + ThisVersion + ')');
MarkTime(Timer);
repeat
x := x + 1;
new := copy(TheNews, x, 1);
if(new = ',') then
begin
AddToReport(' ' + Temp);
Temp := '';
end;
if not (new = ',') then
Temp := Temp + new;
until (new = '|') or (TimeFromMark(Timer) >= 3000)
AddToReport('[==========================]');
Status('Running script...');
end;
//======================================================================\\
// Load Images \\
//======================================================================\\
procedure LoadImages;
begin
OreDTM := DTMFromString('78DA635CC8C0C0D0C98002F6E41A30FC07D28' +
'C40FC1F0818970219B50C6880918115AA06CC5B03241A08A8590E' +
'242611503317484C27A0661211E680CC68C6AF06001A2C0EAA');
end;
//======================================================================\\
// Free Images (This is for the memory) \\
//======================================================================\\
procedure FreeImages;
begin
FreeDTM(OreDTM);
end;
//======================================================================\\
// Find Gas (Anti Random) \\
//======================================================================\\
procedure FindTheGas;
begin
if (FindGas(x, y)) then
begin
//PerfectNorth; // Same here, we don't want to run in the wrong dir
MakeCompass('N');
HighestAngle; // Just to make sure
RunAwayDirection(RunningDir);
Wait(19000);
RunBack;
end;
end;
//======================================================================\\
// FindTheRandoms - Finds the randoms \\
//======================================================================\\
// Switch case because I might extend this one
procedure FindTheRandoms;
var
i: Integer;
begin
for i := 1 to 5 do
begin
case I of
1: FindTalk;
2: FindNormalRandoms;
3: FindTheGas; // Always good to check for this an extra time
4: FindPick; // Checking for the pickaxe
5: FindTalk; // Call it a third time to be sure
end;
Wait(1)
end;
if (FindFight) then
begin
Runawaydirection(RunningDir);
Wait(16000);
RunBack;
end;
end;
//======================================================================\\
// MouseAntiBan - Moves mouse human-like (Anti-ban) By Yakman \\
//======================================================================\\
procedure MouseAntiBan;
begin
if not(LoggedIn)then Exit;
case Random(6) of
0 : IdleTime(1000 + Random(350),500,1.0);
1 : IdleTime(1000 + Random(350),1000,1.0);
2 : IdleTime(1000 + Random(350),750,0.5);
3 : SleepAndMoveMouse(2500 + Random(2500));
4 : SleepAndMoveMouse(1500 + Random(1500));
5 : SleepAndMoveMouse(500 + Random(500));
end
end;
//======================================================================\\
// MyAntiBan - Anti-Ban procedure by Yakman (modded a bit) \\
//======================================================================\\
procedure MyAntiBan;//From Yakman
var
DItem, DBanMe : Integer;
begin
if not(LoggedIn)then
Exit;
if not(UseAntiBan)then
Exit;
DBanMe := Random(18);
case DBanMe of
0 : MMouse(Random(MSX2), Random(MSY2),0,0);
1 : RandomRClickEvery(2 + Random(13));
2 : HoverSkill('mining', False);
3 : HoverSkill('smithing', False);
4 : RotateEvery(20+random(10));
5 : LeaveScreenEvery(5+random(5));
6 : HoverEvery(15+random(5),'random');
7 : HoverEvery(15+random(5),players[currentplayer].skill);
8 : MouseAntiBan;
9 : begin
DItem:=1+random(14);
if(ExistsItem(DItem))then
DragItem(DItem,15+random(10));
end
10 : begin
GameTab(1+random(12));
wait(1500+random(500));
GameTab(4);
end;
11 : HoverSkill('fletching', False);
12 : HoverSkill('cooking', False);
13 : HoverSkill('defence', False);
14 : HoverSkill('hitpoints', False);
15 : HoverSkill('fishing', False);
16 : begin
MakeCompass('S');
wait(1500+random(500));
MakeCompass('N');
end;
17 : begin
MakeCompass('W');
wait(1500+random(500));
MakeCompass('N');
end;
18 : begin
LowestAngle;
Wait(random(500));
MakeCompass('E');
Wait(random(250));
HighestAngle;
Wait(random(500));
MakeCompass('N');
Wait(random(250));
end;
end;
end;
//======================================================================\\
// Start Mining \\
//======================================================================\\
procedure MiningProcedure;
begin
repeat
if(FindObj3( x, y, 'Mine' , OreToMineColor, OreTolerance)) then
begin
MMouse(x,y,0,0);
FindTheGas;
Wait(150+random(100));
Mouse(x,y,0,0,true);
FindTheRandoms;
FindTheGas;
Wait(MiningWait * 1000);
end;
Wait(Random(500));
until (invfull)
end;
//======================================================================\\
// Drop Ore \\
//======================================================================\\
procedure DropOre;
begin
OresMined := OresMined + (CountItemDtm(OreDTM) - 8);
Experience := OresMined * ExpValue;
repeat
if(FindDTM(OreDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then
begin
Mouse(x, y, 0, 0, false);
wait(400 + random(100));
ClickOption('rop',2);
wait(1000 + random(200));
FindTheRandoms;
end;
until (not FindDTM(OreDTM,x,y,MIX1,MIY1,MIX2,MIY2))
LoadsDone := LoadsDone + 1;
end;
//======================================================================\\
// Setup Player \\
//======================================================================\\
procedure SetupPlayer;
begin
Loadsdone:=0;
MakeCompass('N');
HighestAngle;
FindPickHeadColor;
// Setup the color to mine
case Players[CurrentPlayer].String1 of
'Copper' : OreToMineColor := CopperColor;
'Tin' : OreToMineColor := TinColor;
'Iron' : OreToMineColor := IronColor;
'Silver' : OreToMineColor := SilverColor;
'Gold' : OreToMineColor := GoldColor;
'Coal' : OreToMineColor := CoalColor;
'Mithril': OreToMineColor := MithrilColor;
'Addy' : OreToMineColor := AdamantiteColor;
end;
// I rather do this than using begin and end, less code
case Players[CurrentPlayer].String1 of
'Copper' : ExpValue := 17.5;
'Tin' : ExpValue := 17.5;
'Iron' : ExpValue := 35;
'Silver' : ExpValue := 40;
'Gold' : ExpValue := 65;
'Coal' : ExpValue := 50;
'Mithril': ExpValue := 80;
'Addy' : ExpValue := 95;
end;
end;
//======================================================================\\
// Switch Player \\
//======================================================================\\
procedure SwitchPlayer;
begin
if((CurrentPlayer + 1) = AmountOfPlayers) then
begin
Writeln('The script is now done!');
Logout;
TerminateScript;
end;
NextPlayer(True);
OresMined := 0; // We must set this to 0 since it's a new char
Experience := 0; // We must set this to 0 since it's a new char
Writeln('Switched players successfully');
SetupPlayer;
end;
//======================================================================\\
// Setup Script \\
//======================================================================\\
procedure SetupScript;
begin
SetUpSRL;
DisguiseScar('Untitled - Notepad');
EquipPick := PickWielded; // Necessary
LoadImages;
wait(2000);
DeclarePlayers;
ActivateClient;
LoginPlayer;
SetUpSRLMining;
PickUpItems := True; // Picking up randoms items if pickhead is gone
BenMouse := False; // Turning of BenMouse to speed up a little
SetupPlayer;
end;
//======================================================================\\
// The Main Loop \\
//======================================================================\\
procedure MainLoop;
begin
repeat
if (LoadsDone = HowManyLoads) then
SwitchPlayer;
FindTheRandoms;
if (not (LoggedIn)) then
begin
FreeImages; // The script stops now and we must free the memory
Exit;
end;
MiningProcedure;
DropOre;
MyAntiBan;
ProgressReport;
until (false) // Never ending loop I know but I have "If not logged in"
end;
begin
Cleardebug;
ClearReport;
Signature;
if (CheckForUpdates) then
CheckVersion;
if (DownloadNewsVar) then
DownloadNews;
SetupScript;
MainLoop;
end.