SCAR Code:
program kottonmouth_woodcutter;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Mining.scar}
const PruneDebug = true; //Will Clean Up debug When Reporting
ReportAll = False; // Set To False for now
ReportPath = ''; //Only if above is true
ToRespond = true; //Set true to autorespond
WheretoRunAway = 'N'; // Which way to run if a fight is found
PwnDebug = False; //Debug Everything?
MaxTimeToWait = 10; //In Seconds, Max time to wait for rock
//set to 0 for never
UseShieldFinder = false; //Used To UnEquip shield(May mess up mining)
Const // TY Wizzup?
CopperColor = 4286610;
TinColor = 9277080;
ClayColor = 4553880;
IronColor = 2700888;
SilverColor = 12434885;
CoalColor = 2834753;
GoldColor = 1881051;
MithrilColor = 7359564;
procedure ClearPlayerVars(WhichPlayer : integer); Forward;
Procedure DeclarePlayers;
var
I : Integer;
begin
SRLID := '';
SRLPassword := '';
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='four2zero1';
Players[0].Pass :='timeout';
Players[0].Nick :='our';
Players[.Integers[2] := '50'; //Loads To Do
Players[0].Strings[0] := 'Iron'; //Copper, Tin, Iron, Silver, Coal, Gold, Mithril
Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Integers[2] := 50; //Loads To Do
Players[1].Strings[0] := 'Iron'; //Copper, Tin, Iron, Silver, Coal, Gold, Mithril
{Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Integers[2] := 50; //Loads To Do
Players[2].Strings[0] := 'Iron'; //Copper, Tin, Iron, Silver, Coal, Gold, Mithril
Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Integers[2] := 50; //Loads To Do
Players[3].Strings[0] := 'Iron'; //Copper, Tin, Iron, Silver, Coal, Gold, Mithril
Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Integers[2] := 50; //Loads To Do
Players[4].Strings[0] := 'Iron'; //Copper, Tin, Iron, Silver, Coal, Gold, Mithril
}
Writeln('Player(s): '+IntToStr(HowManyPlayers)+';');
For I := 0 to HowManyPlayers - 1 do
ClearPlayerVars(I);
end;
Procedure ClearShield;
var
rndx,rndy :integer;
begin
GameTab(5)
if FindColor(rndx,rndy,65536,681,287,715,322)then
mouse(698,302,10,10,true);
end;
Procedure ChatBoxStyle;
begin
If GetColor(17,484) = 1452085 then exit else Mouse(51,496,3,3,true);
SetChat('friends',1);
end;
procedure Tab11Details;
begin
Gametab(11);
if not GetColor(709,229) = 9584920 then Mouse(709,229,3,3,true);
if not GetColor(609,265) = 10172937 then Mouse(609,265,3,3,true);
if not GetColor(608,302) = 10172937 then Mouse(608,302,3,3,true);
if not GetColor(607,339) = 10172937 then Mouse(607,339,3,3,true);
SetRun(true);
end;
function MyGetPickColor : integer;
var
PickMask,px,py : integer;
begin
GameTab(4);
PickMask := BitmapFromString(18, 14, 'z78DA33304000373030A00BA0' +
'BF5DF4B471D45E4AF4926A02E53E25DE765A842A7EDB691D8 F98F' +
'6D227E5D03F7D8E640000833A28F8');
if findbitmapmasktolerance(Pickmask,px,py,552,205,735 ,465,4,4) then
begin
Players[CurrentPlayer].Integers[5] := GetColor(px,Py);
Result := GetColor(px,Py);
Writeln('Current Pick Color = '+IntToStr(Players[CurrentPlayer].integers[5])+' [Inventory]');
Exit;
end else
begin
Gametab(5);
if not findbitmapmasktolerance(Pickmask,px,py,552,205,735 ,465,4,4) then
begin
Writeln('No Pick Found! Exitting');
NextPlayer(False);
end else
begin
Players[CurrentPlayer].Integers[5] := GetColor(px,Py);
Result := GetColor(px,Py);
Writeln('Current Pick Color = '+IntToStr(Players[CurrentPlayer].integers[5])+' [Equiped]');
Mouse(Px,Py,0,0,true);
Wait(1200);
end;
end;
end;
procedure SCST2(h,s: extended); Forward;
function HavePick : boolean;
var
px, py : integer;
begin
Gametab(4);
ColorToleranceSpeed(1);
px := 576;
py := 210;
result := FindColorSpiralTolerance(px,py,Players[CurrentPlayer].integers[5],552,205,735,465,1);
end;
function MyFindPick : boolean;
var
Px, Py, I : integer;
tmpArray : Array of TPoint;
begin
result := false;
MouseSpeed := 30;
ColorToleranceSpeed(1);
FindColorsSpiralTolerance(px,py,tmpArray,Players[CurrentPlayer].Integers[5],MSX1,MSY1,MSX2,MSY2,2);
For I := 0 to GetArrayLength(tmpArray) - 1 do
begin
MMouse(tmparray[i].X,tmparray[i].y,0,0);
If IsUpText('ead')then
begin
Mouse(tmpArray[i].X,tmpArray[i].Y,0,0,true);
Flag;
wait(800);
Gametab(4);
If Not HavePick then
begin
Writeln('Failed Getting Pick, Exitting');
NextPlayer(false);
end;
If FindColorSpiralTolerance(px,py,Players[CurrentPlayer].integers[5],552,205,735,465,1)then
begin
Mouse(px,py,0,0,true);
For I := 1 to 28 do
begin
MMouseItem(I);
If IsUpText('andl')then
begin
MouseItem(I,true);
result := true;
Exit;
end;
end;
end;
end;
end;
end;
Procedure SCST2(h,s: extended);
var
tmpint : integer;
begin
tmpint := GetColorToleranceSpeed;
if not tmpint = 2 then
begin
SetColorSpeed2Modifiers(h,s);
ColorToleranceSpeed(2);
end;
end;
Procedure Setupplayer;
begin
OreColor := 0;
NickNameBMP := CreateBitMapMaskFromtext(Players[CurrentPlayer].Nick,UpChars);
Case Lowercase(Players[CurrentPlayer].Strings[0]) of
'copper' : OreColor := CopperColor;
'tin' : OreColor := TinColor;
'iron' : OreColor := IronColor;
'coal' : OreColor := CoalColor;
'silver' : OreColor := SilverColor;
'gold' : OreColor := GoldColor;
'mith','mithril' : OreColor := MithrilColor;
end;
If OreColor = 0 then
begin
Writeln('Invalid Ore Name, Exitting');
Nextplayer(false);
end;
If SRLId = '' then
begin
SRLid := '2426';
SRLPassword := 'kjsahf245';
end;
if Not LoggedIn then LoginPlayer;
ChatBoxStyle;
Tab11Details;
HighestAngle;
MakeCompass('N');
If UseShieldFinder then ClearShield;
MyGetPickColor;
SetChat('friends',1);
end;
var
X,Y, AllMined, AllGases, RocksMinedThisRun, GasesThisRun,Runs,L, Responded :Integer;
procedure ClearPlayerVars(WhichPlayer : integer);
begin
Players[WhichPlayer].Integers[0] := 0;
Players[WhichPlayer].Integers[1] := 0;
Players[WhichPlayer].Active := True;
RocksMinedThisRun := 0;
GasesThisRun := 0;
Players[WhichPlayer].Loc := 'Mine';
end;
procedure Reset(var X, Y : integer);
begin
try
X := Round(MSX2/2);
Y := Round(MSY2/2);
except
X := MSCX;
Y := MSCY;
end;
end;
function Taken : boolean;
var
i : integer;
begin
For I := 588 downto 580 do
begin
result := (GetColor(655,I) = 0);
If Not result then exit;
end;
result := true;
Players[CurrentPLayer].Loc := 'Taken';
end;
function FindGasAt(x,y : integer) : boolean; Forward;
function FindMiningRandoms(xx,yy : integer) : boolean;
var
I : integer;
begin
For I := 19 downto 1 do
case I of
18 : If SolveChatRandom then result := true;
17 : If FindDemon then Result := True;
16 : if (FindBox) then
begin
Result := True;
if (UseBoxSolver) then
SolveBox
else
GambleBox;
end;
15 : If Taken Then result := True;
14 : If FindTalk then result := true;
13 : If FindDead then result := true;
12 : If FindMod then result := true;
11 : begin
If FindFight then
begin
result := true;
RunTo(WhereToRunAway,false);
wait(10000);
RunBack;
end;
end;
10 : If FindLamp('Mining') then result := true;
9 : If FindTalk then result := true;
8 : If FindMime then result := true;
7 : If InBlack then result := true;
6 : If FindGasAt(xx,yy) then result := true;
5 : If NoGameTab then result := true;
4 : If FindTalk then result := true;
3 : RC;
2 : begin
If Not HavePick then
begin
result := true;
MyFindPick;
end;
end;
1 : If FindGas(xx,yy) then Result := true;
end;
end;
Procedure MMouseBox(Box : TBOX);
begin
MMouse(Box.X1,Box.Y1,(Box.X2 - Box.X1),(Box.Y2 - Box.y1));
end;
function FindRock(var xx, yy : integer; RockColor : integer) : boolean;
var
tmpBox : TBox;
begin
ColorToleranceSpeed(1);
Reset(xx,yy);
tmpBox := IntToBox(245,167,274,186);
result := ((FindColorSpiral2(xx,yy,RockColor,25,25,(MSX2-25),(MSY2-25))) and Not (IntInBox(xx,yy,tmpBox)));
MMouse(XX,YY,0,0);
if not IsUptext('ine')then
begin
result := false;
exit;
end;
ColorToleranceSpeed(1);
Mouse(xx,yy,0,0,true);
Flag;
Wait(600);
If FindMiningRandoms(xx,yy) then exit;
Sleep(800);
end;
function FindtheRock(var xx, yy : integer; RockColor : integer) : boolean;
var
tmpTArray : array of TPoint;
I : integer;
begin
SCST2(0.2,0.2);
Reset(xx,yy);
FindColorsSpiralTolerance(xx,yy,tmpTArray,RockColo r,25,25,(MSX2-25),(MSY2-25),1);
for I := 0 to GetArrayLength(tmpTArray) - 1 do
begin
MMouse(tmpTArray[i].X,TmpTArray[i].Y,0,0);
If IsUpText('ine')then
begin
GetMousePos(Xx,YY);
ColorToleranceSpeed(1);
Mouse(xx,yy,0,0,true);
If FindMiningRandoms(xx,yy) then exit;
Flag;
Sleep(800);
Result := true;
Exit;
end;
end;
end;
function GasColorsPresent : boolean;
var
rndx,rndy,mark :integer;
begin
Reset(x,y);
ColorToleranceSpeed(1);
Result := FindColorSpiralTolerance(x,y,6194063,(MSCX - 50), (MSCY - 50), (MSCX + 50), (MSCY + 50),2);
If Result then
begin
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + 1;
GasesthisRun := GasesThisRun + 1;
ReportVars[2] := 1;
SendSRLReport;
MouseSpeed := 40;
MouseFindNoFlag(645,88,3,3);
Flag;
MouseSpeed := 15 + random(5);
Writeln('Gas Was Found at ('+IntToStr(rndx)+','+IntToStr(rndy)+')!');
MarkTime(Mark);
Players[CurrentPlayer].Loc := 'Gas';
GasesThisRun := GasesThisRun + 1;
ReportVars[2] := 1;
SendSRLReport;
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + 1;
repeat
if FindNormalRandoms then exit;
If Taken then exit;
until(TimeFromMark(Mark) > 37000) or not (FindColorSpiralTolerance(x,y,6194063,MSX1, MSY1, MSX2, MSY2,2));
end;
end;
function FindGasAt(x,y : integer) : boolean;
var
rndx, rndy, mark :Integer;
tmpBox :TBox;
begin
ColorToleranceSpeed(1);
tmpBox := IntToBox((x - 23),(y - 22),(X + 36),(y + 13));
if not FindColorSpiralTolerance(rndx,rndy,6194063,tmpbox. x1,tmpbox.y1,tmpbox.x2,tmpbox.y2,10) then
begin
result := False;
ColorToleranceSpeed(1);
Exit;
end else
begin
if not IntInBox(rndx,rndy,tmpBox) then exit;
MouseSpeed := 40;
MouseFindNoFlag(645,88,3,3);
Flag;
MouseSpeed := 15 + random(5);
Writeln('Gas Was Found at ('+IntToStr(rndx)+','+IntToStr(rndy)+')!');
MarkTime(Mark);
GasesThisRun := GasesThisRun + 1;
ReportVars[2] := 1;
SendSRLReport;
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + 1;
repeat
if FindnormalRandoms then exit;
If Taken then exit;
until(TimeFromMark(Mark) > 37000);
ColorToleranceSpeed(1);
end;
end;
function CombineTPA(Arr1, Arr2: TPointArray): TPointArray;
var
I, L1, L2: Integer;
begin
SetArrayLength(Result, GetArrayLength(Arr1) + GetArrayLength(Arr2));
L1 := GetArrayLength(Arr1);
for I := 0 to L1 - 1 do
Result[i] := Arr1[i];
L2 := GetArrayLength(Result);
for I := L1 to L2 - 1 do
Result[i] := Arr2[I - GetArrayLength(Arr1)];
end;
function FollowRock(Var rx, ry: Integer; rColor: Integer): Boolean;
var
RCPoint, RGPoint, Rocks :TPointArray;
I :Integer;
begin
ColorToleranceSpeed(2);
FindColorsTolerance(RCPoint, rColor, rx - 20, ry - 20, rx + 20, ry + 20, 19);
SetColorspeed2Modifiers(0.2, 0.2);
FindColorsTolerance(RGPoint, 1527647, rx - 20, ry - 20, rx + 20, ry + 20, 9);
SetColorspeed2Modifiers(0.2, 0.2);
if GetArrayLength(RCPoint) < 4 Then Exit;
Rocks := CombineTPA(RCPoint, RGPoint);
rx := 0;
ry := 0;
for I := 0 To GetArrayLength(Rocks) - 1 Do
begin
rx := rx + Rocks[i].X;
ry := ry + Rocks[i].Y;
end;
if GetArrayLength(Rocks) <> 0 Then
begin
rx := Round(rx Div GetArrayLength(Rocks));
ry := Round(ry Div GetArrayLength(Rocks));
Result := True;
end;
ColorToleranceSpeed(1);
end;
function FollowRockAt(var X,Y : integer; RockColor : integer) : boolean;
begin
ColorToleranceSpeed(1);
While FlagPresent Do
begin
FollowRock(x,y,RockColor);
end;
FollowRock(x,y,RockColor);
result := true;
end;
function RockGoneAt(X,Y : integer; RockColor : integer) : boolean;
var
tmpBox :TBOX;
begin
ColorToleranceSpeed(1);
TmpBox := IntToBox((x - 15),(y - 15),(x + 15),(y + 15));
result := not FindColorSpiralTolerance(x,y,RockColor,tmpBox.x1,t mpbox.y1,tmpbox.x2,tmpbox.y2,5);
end;
function Leveled : boolean;
var
I : integer;
begin
result := FindBlackChatMessage('advanced');
If not result then exit;
I := random(4);
case I of
0 : TypeSend('Woot');
1 : TypeSend('W00t');
2 : TypeSend('o yeah');
3 : TypeSend('lvled');
4 : TypeSend('leveled');
end;
GetAllLevels;
end;
function Responder : boolean;
begin
If InChat('mining') or InChat('mine') or InChat('minin') and InChat('lvl') or InChat('lvls') or InChat('level') or InChat('levels')then
begin
SayCurrentLevels('Mining');
Responded := Responded + 1;
result := true;
Exit;
end;
end;
function AntiBan : boolean;
begin
if ToRespond then
if Responder then
result := true;
If Leveled then
begin
L := L + 1;
result := true;
ReportVars[3] := 1;
SendSRLReport;
end;
If GasColorsPresent then result := true;
end;
function MineRock(RockColor : integer) : boolean;
var
Mark : integer;
begin
result := false;
If InvFull then exit;
If FindRock(x,y,RockColor)then
If FollowRock(x,y,RockColor) then
begin
MarkTime(Mark);
repeat
FindMiningRandoms(x,y);
If not MaxTimeToWait = 0 then
If TimeFromMark(Mark) >= (MaxTimeToWait * 1000)then
begin
If PwnDebug then Writeln('Max Time, Breaking Out');
Break;
end;
until RockGoneAt(x,y,RockColor);
result := true;
If PwnDebug then Writeln('Rock Mined At ('+IntToStr(X)+','+IntToStr(Y)+');');
end;
end;
procedure UpDateAllStats;
{var
S :integer;}
begin
{if not FileExists(Reportpath) then
begin
RewriteFile(ReportPath,true);
WriteINI('Runs','#','0',ReportPath);
WriteINI('RocksMined','#','0',ReportPath);
WriteINI('Gases','#','0',ReportPath);
Exit;
end
Runs := ReadINI('Runs','#',ReportPath);
AllMined := ReadINI('RocksMined','#',ReportPath);
AllGases := ReadINI('Gases','#',ReportPath);
AllMined := AllMined + RocksMinedThisRun;
Runs := Runs + 1;
AllGases := AllGases + GasesThisRun;}
end;
const v = '2.0 BETA';
procedure ProgressReport;
var
H, M, S, I : integer;
begin
SRLRandomsReport;
If PruneDebug then ClearDebug;
Writeln(' /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \');
Writeln(' | miner Version '+V+' |');
Writeln(' | Made by KoTtOnMoUtH |');
Writeln(' \~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~/');
Writeln('');
ConvertTime(GetTimeRunning,H,M,S);
Writeln(' Worked For ' + InttoStr(H) + ' hours, ' + IntToStr(M) + ' minutes and '+ IntToStr(S) + ' seconds ');
Writeln(' Mined '+IntToStr(RocksMinedThisRun)+' rock(s)');
Writeln(' Handled '+IntToStr(GasesThisRun)+' gas(es)');
Writeln(' Levels Gained : '+IntToStr(l));
Writeln(' Responded : '+IntToStr(Responded)+' times');
Writeln('');
If ReportAll then
begin
UpDateAllStats;
Writeln(' |-------------------------------|');
Writeln(' | All-Time Running Report |');
Writeln(' |-------------------------------|');
Writeln(' Script Runs : ' + IntToStr(Runs));
Writeln(' Mined : '+IntToStr(AllMined)+' total rocks');
Writeln(' Handled : '+IntToStr(AllGases)+' total gases');
Writeln('');
end;
Writeln(' # | Nick | MiningLevel | RocksMined | Gases Encountered | Loc');
Writeln('');
For I := 0 to HowManyPlayers - 1 do
begin
Writeln(' '+IntToStr(I)+' | '+Players[i].Nick+' | ML = '+IntToStr(Players[i].Level[13])+' | Mined '+IntToStr(Players[i].Integers[0])+' rocks | Handled '+IntToStr(Players[CurrentPLayer].integers[1])+' gases | Loc: '+Players[i].Loc);
end;
end;
procedure StopDumbVars;
begin
OreColor := 0;
OreColor1 := 0;
OreColor2 := 0;
OreColor3 := 0;
end;
function Drop : boolean;
var
OreMask : integer;
Inv1, Inv2 : TPoint;
begin
Writeln('Dropping');
OreMask := BitmapFromString(17, 18, 'z78DA3330C00EDCC000BF0831' +
'BA88016E4800970825E613EF3BEA9A8F090CA804F09B46B95 DD48' +
'D6B4A429B545B70A525DAF9855A2650620B79298D98544479 EAA5' +
'6ECA1F58BBE8E3177A86D828201E0000B9AF6F00');
GameTab(4);
Inv1.X := 547;
Inv1.Y := 200;
Inv2.X := 736;
Inv2.Y := 466;
while FindBitmapMaskTolerance(OreMask,X,Y,Inv1.X,Inv1.Y, Inv2.X,Inv2.Y,3,3) do
begin
Mouse(X,Y,10,10,false);
result := ChooseOption('rop');
wait(1100 + random(200));
Players[CurrentPlayer].Integers[0] := Players[CurrentPlayer].Integers[0] + 1;
RocksMinedThisRun := RocksMinedThisRun + 1;
ReportVars[0] := 1;
SendSRLReport;
end;
end;
Procedure ChangePlayer(Active : boolean);
begin
NextPlayer(Active);
SetupPlayer;
end;
var
frmDesign : TForm;
Label1 : TLabel;
Label2 : TLabel;
Button1 : TButton;
Button2 : TButton;
procedure InIt;
begin
frmDesign := CreateForm;
frmDesign.Left := 458;
frmDesign.Top := 287;
frmDesign.Width := 395;
frmDesign.Height := 157;
frmDesign.BorderIcons := [biSystemMenu];
frmDesign.Caption := '!!!';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 42;
Label1.Top := 18;
Label1.Width := 302;
Label1.Height := 13;
Label1.Caption := 'PLEASE MAKE SURE YOU HAVE PICKED COLORS IN LINES';
Label1.Font.Color := clWindowText;
Label1.Font.Height := -12;
Label1.Font.Name := 'MS Sans Serif';
Label1.Font.Style := [];
Label1.ParentFont := False;
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 169;
Label2.Top := 43;
Label2.Width := 39;
Label2.Height := 13;
Label2.Caption := '51 - 59 !';
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 73;
Button1.Top := 72;
Button1.Width := 96;
Button1.Height := 26;
Button1.Caption := 'Continue';
Button1.ModalResult := 1;
Button1.TabOrder := 8;
Button2 := TButton.Create(frmDesign);
Button2.Parent := frmDesign;
Button2.Left := 214;
Button2.Top := 72;
Button2.Width := 96;
Button2.Height := 26;
Button2.Caption := 'Exit';
Button2.ModalResult := 3;
Button2.TabOrder := 9;
end;
procedure SafeInitForm;
var
vl: TVariantArray;
begin
setarraylength(Vl, 0);
ThreadSafeCall('InIt', vl);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
vl: TVariantArray;
begin
setarraylength(Vl, 0);
ThreadSafeCall('ShowFormModal', vl);
end;
procedure Form;
begin
SafeInitForm;
SafeShowFormModal;
end;
begin
GetSelf.WindowState := wsMinimized;
Form;
SetupSRL;
ScriptId := '287';
DeclarePlayers;
SetupMining;
MouseSpeed := 15;
Setupplayer;
repeat
repeat
If Not Loggedin Then LoginPlayer;
MineRock(OreColor);
until(InvFull);
Drop;
ProgressReport;
if (Players[CurrentPlayer].Integers[0] >= (Players[CurrentPlayer].Integers[2] * 28)) then ChangePlayer(false);
until(false);
ProgressReport;
end.