Snowflak
2012-03-06 20:07:10
Try this guys
{$I SRL/SRL.simba}
var
Sst: Integer;
Ver: string;
procedure DeclarePlayers;
begin
HowManyPlayers := 4; //How many players in the script. (No Need To Touch. For Those Players What You Don't Wan't To Use Put Active := False;)
CurrentPlayer := 0; //Current player in the Players array.
NumberOfPlayers(HowManyPlayers); //Don't change.
with Players[0] do
begin
Name := ''; {Player Username}
Pass := ''; {Player Password}
Pin := ''; {Player Bank Pin}
Integers[20] := 10; {How Much Invest Per Suicide}
Active := True; {Use This Player?}
end;
end;
procedure SDebug(Debug: string);
begin
Writeln('[' + TheTime + '] - ' + 'Debug: ' + Debug);
end;
function ScenarioScreen :Boolean;
begin
Result := CountColorTolerance(2071039, 20, 29, 474, 47, 20) > 250;
end;
function SiegeScreen :Boolean;
begin
Result := CountColorTolerance(2071039, 20, 29, 474, 47, 20) > 400;
end;
function RecruitScreen :Boolean;
begin
Result := CountColorTolerance(2071039, 21, 14, 466, 34, 20) > 100;
end;
function InvestmentScreen :Boolean;
begin
Result := CountColorTolerance(3512831, 279, 58, 481, 77, 20) > 300;
end;
function FindRecruiter :Boolean;
var
TPA: TPointArray;
aTPA : T2DPointArray;
MiddlePoint :TPoint;
Hi, I, TempCTS :Integer;
begin
Flag;
while IsMoving do Wait(RandomRange(100, 250));
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.29);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 7492688, MSX1, MSY1, MSX2, MSY2, 19);
If Length(TPA) = 0 Then Exit;
aTPA := TPAToATPAEx(TPA, 5, 5);
SortATPAFromFirstPoint(aTPA, Point(MSCX, MSCY));
Hi := Length(aTPA);
for I := 0 to Hi - 1 do
begin
MiddlePoint := MiddleTPA(aTPA);
MMouse(MiddlePoint.X, MiddlePoint.Y, 2, 2);
If WaitUpTextMulti(['Recr', 'ecru', 'uiter'], 150) then
begin
ClickMouse2(Mouse_Right);
If WaitOptionMulti(['Manage', 'anage', 'nage'], 350) then
begin
Flag;
Result := WaitFunc(@RecruitScreen, RandomRange(100, 250), 3500);
If Result then
Break;
end;
end;
end;
ColorToleranceSpeed(TempCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function FindEntrance :Boolean;
var
TPA: TPointArray;
aTPA : T2DPointArray;
MiddlePoint :TPoint;
Hi, I, TempCTS :Integer;
begin
Flag;
SDebug('Finding Entrance');
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 2.78);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 11327460, MSX1, MSY1, MSX2, MSY2, 14);
If Length(TPA) = 0 Then Exit;
aTPA := TPAToATPAEx(TPA, 5, 5);
SortATPASize(aTPA, True);
Hi := Length(aTPA);
for I := 0 to Hi - 1 do
begin
If Length(aTPA) > 100 then Continue;
MiddlePoint := MiddleTPA(aTPA);
MMouse(MiddlePoint.X, MiddlePoint.Y, 2, 2);
If WaitUpTextMulti(['limb', 'room', 'rance'], 150) then
begin
ClickMouse2(Mouse_Right);
If WaitOptionMulti(['limb', 'Cli', 'own', 'Dow'], 350) then
begin
Flag;
Result := WaitFunc(@ScenarioScreen, RandomRange(100, 250), 5500);
If Result then
Break;
end;
end;
end;
ColorToleranceSpeed(TempCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function FindWall(SP :TPoint) :Boolean;
var
TPA: TPointArray;
aTPA : T2DPointArray;
MiddlePoint :TPoint;
Hi, I, TempCTS :Integer;
begin
MMouse(SP.X, SP.Y, 5, 5);
If WaitUpTextMulti(['Castle', 'astle', 'sle', 'wall'], 250) then
begin
ClickMouse2(Mouse_Right);
If WaitOptionMulti(['ttack C', 'ack Ca'], 350) then
begin
Result := True
Exit;
end;
end;
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.05, 0.58);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 9544365, MSX1, MSY1, MSX2, MSY2, 14);
If Length(TPA) = 0 Then Exit;
aTPA := TPAToATPAEx(TPA, 40, 40);
SortATPAFromFirstPoint(aTPA, SP);
Hi := Length(aTPA);
for I := 0 to Hi - 1 do
begin
MiddlePoint := MiddleTPA(aTPA);
MMouse(MiddlePoint.X, MiddlePoint.Y, 0, 0);
If WaitUpTextMulti(['Castle', 'astle', 'sle', 'wall'], 150) then
begin
ClickMouse2(Mouse_Right);
If WaitOptionMulti(['ttack C', 'ack Ca'], 350) then
begin
Result := True
Break;
end;
end;
end;
ColorToleranceSpeed(TempCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
//North = Blue.
//South = Red.
//East = Yellow.
//West Green.
function GetArmyLocation(var Dir : Integer; var StartPoint :TPoint) : String;
var
DirArr, Colors :TIntegerArray;
I :Integer;
Loc :TStringArray;
TPA :TPointArray;
begin
SDebug('Searching Army Location');
Loc := ['W', 'S', 'E', 'N'];
{Green = 297 Red = 280 Yellow = 280 Blue 270}
Colors := [441136, 592313, 567264, 13504519]
{0 = Up 1 = Right 2 = Down, 3 = Left}
DirArr := [1, 0, 3, 2];
TPA := [Point(359, 117), Point(244, 140), Point(185, 134), Point(280, 220)]
for I := 0 to 3 do
If CountColorTolerance(Colors, MCX1, MCY1, MCX2, MCY2, 20) > 100 then
begin
Dir := DirArr;
StartPoint := TPA;
Result := Loc;
SDebug('Location Is ' + Result);
Exit;
end;
end;
function MoveToCastle(var SP :TPoint) :String;
var
Loc :String;
Dir, I, C :Integer;
StartPoint :TPoint;
begin
Loc := GetArmyLocation(Dir, StartPoint);
SDebug('Moving To Castle ' + Result);
If Loc = '' then Exit;
If (Loc = 'E') or (Loc = 'W') then
C := 1
else
C := 2;
SDebug('We Need ' + IntToStr(C + 1) + ' Moves');
for I := 0 to C do
SendArrowWait(Dir, RandomRange(250, 350));
SP := StartPoint;
Result := Loc;
SDebug('Moved Succesfully');
Wait(RandomRange(2000, 3500));
end;
function TroopsTab :Boolean;
var
TPA :TPointArray;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.70);
FindColorsTolerance(TPA, 8762062, MIX1, MIY1, MIX2, MIY2, 14);
Result := Length(TPA) > 150;
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function NotTroopsTab :Boolean;
begin
Result := not TroopsTab;
end;
function WaitTroopsTab(Time :Integer) :Boolean;
var
T :Integer;
begin
If TroopsTab then
begin
Result := True;
Exit;
end;
MarkTime(T);
while (TimeFromMark(T) < Time) do
begin
If Not LoggedIn then Exit;
TypeByte(112);
Wait(RandomRange(250, 355));
if TroopsTab then
begin
Result := True;
Break;
end;
end;
end;
procedure MobiliseArmy;
var
Loc :String;
TPA :TPointArray;
aTPA :T2DPointArray;
MiddlePoint, StartPoint :TPoint;
I, Hi :Integer;
begin
Loc := MoveToCastle(StartPoint);
WaitTroopsTab(RandomRange(1500, 2500));
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.70);
FindColorsTolerance(TPA, 8762062, MIX1, MIY1, MIX2, MIY2, 14);
If Length(TPA) <> 0 then
begin
aTPA := TPAtoATPAEx(TPA, 10, 10)
Hi := Length(aTPA);
for I := 0 to Hi - 1 do
begin
SDebug('Troop ' + IntToStr(I) + ' Attack!');
WaitTroopsTab(RandomRange(1500, 2500));
MiddlePoint := MiddleTPA(aTPA);
Mouse(MiddlePoint.X, MiddlePoint.Y, 3, 3, mouse_Left);
FindWall(StartPoint);
WaitFunc(@NotTroopsTab, RandomRange(25, 50), 1500);
end;
end;
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
SDebug('All Troops Are Attacking Castle');
end;
function BlackMM(Percent, PercentBlackMM, Time :Integer) :Boolean;
var
T :Integer;
begin
MarkTime(T);
while (TimeFromMark(T) < Time) do
begin
If Not LoggedIn then Exit;
Wait(RandomRange(10, 25));
if PercentBlackMM >= Percent then
begin
Result := True;
Break;
end;
end;
end;
function GetIn :Boolean;
begin
If FindEntrance then
begin
SDebug('Found Entrance');
if WaitFunc(@ScenarioScreen, RandomRange(100, 250), 3500) then
Mouse(341, 127, 10, 10, mouse_Left);
if WaitFunc(@SiegeScreen, RandomRange(100, 250), 3500) then
Mouse(438, 294, 5, 5, mouse_Left);
if WaitFunc(@InvestmentScreen, RandomRange(100, 250), 3500) then
begin
Wait(RandomRange(100, 250));
Mouse(284, 209, 5, 5, mouse_Left);
While not GetColor(472, 394) = 0 do
begin
If Not LoggedIn Then Exit;
Wait(RandomRange(300, 450));
end;
Wait(RandomRange(900, 1000));
SDebug('Investing ' + IntToStr(Players[CurrentPlayer].Integers[20]) + ' Points');
TypeSend(IntToStr(Players[CurrentPlayer].Integers[20]));
Mouse(385, 303, 5, 5, mouse_Left);
end;
end;
end;
function InBattle :Boolean;
var
I :Integer;
Colors :TIntegerArray;
begin
{Green = 297 Red = 280 Yellow = 280 Blue 270}
Colors := [441136, 592313, 567264, 13504519]
for I := 0 to 3 do
If CountColorTolerance(Colors, 8, 345, 17, 468, 20) > 100 then
Result := True;
end;
function MiniGameArea :Boolean;
begin
Result := Length(GetMiniMapDots('NPC')) > 3;
end;
function WaitRoom :Boolean;
var
T :Integer;
begin
MarkTime(T);
SDebug('In Waiting Room');
while (TimeFromMark(T) < 300000) do
begin
If Not LoggedIn then Exit;
Wait(RandomRange(10, 25));
if InBattle then
begin
Result := True;
Wait(RandomRange(2500, 3500));
SDebug('At War');
Break;
end;
end;
end;
function SimpleClose :Boolean;
begin
If CountColorTolerance(7490635, MSX1, MSY1, MSX2, MSY2, 29) > 150 then
begin
SDebug('Closing Result Screen');
MMouse(457, 57, 3, 3);
If WaitUpTextMulti(['Click', 'ick'], 350) then
ClickMouse2(mouse_Left);
Wait(RandomRange(500, 600));
end;
end;
function FindLadders :Boolean;
var
TPA: TPointArray;
aTPA : T2DPointArray;
MiddlePoint :TPoint;
Hi, I, TempCTS :Integer;
begin
MakeCompass('N');
for I := 0 to 1 do
SimpleClose;
SDebug('Finding MainScreen Ladders');
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.40);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3557721, MSX1, MSY1, MSX2, MSY2, 13);
If Length(TPA) = 0 Then Exit;
aTPA := TPAToATPAEx(TPA, 30, 30);
SortATPASize(aTPA, True);
Hi := Length(aTPA);
for I := 0 to Hi - 1 do
begin
MiddlePoint := MiddleTPA(aTPA);
MMouse(MiddlePoint.X, MiddlePoint.Y, 2, 2);
If WaitUpTextMulti(['limb', 'tairs', 'up'], 250) then
begin
ClickMouse2(Mouse_Right);
If WaitOptionMulti(['limb', 'Cli', 'own', 'Dow'], 350) then
begin
Flag;
Result := WaitFunc(@MiniGameArea, RandomRange(100, 250), 5500);
SDebug('Found Ladders');
Break;
end;
end;
end;
Wait(RandomRange(1000, 2000));
ColorToleranceSpeed(TempCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
procedure AntiBan;
var r: Integer;
begin
if not LoggedIn then Exit;
r := (RandomRange(1, 14));
if (r = 4) then
begin
SDebug('AntiBan');
case Random(20) of
0:
begin
MakeCompass('Random');
end;
1:
begin
RandomRClick;
end;
2:
SetAngle(SRL_ANGLE_HIGH);
3:
RandomRClick;
4:
Mouse(MIX1, MIY1, MIX2, MIY2, False);
5:
MMouse(MMX1, MMY1, MMX2, MMY2);
end;
SDebug('Sleeping..');
end;
end;
function WhileInBattle :Boolean;
var
T :Integer;
TPA :TPointArray;
begin
MarkTime(T);
SDebug('Sleeping..');
while (TimeFromMark(T) < 1800 * 1000) do
begin
If Not LoggedIn then Exit;
AntiBan;
Wait(RandomRange(1500, 2500));
if not InBattle then
begin
Result := True;
Wait(RandomRange(1500, 2500));
SDebug('War Is Over!');
Break;
end;
end;
end;
function OutOfCredits :Boolean;
begin
Result := CountColorTolerance(6710886, 32, 298, 121, 316, 2) > 200;
end;
function ReSupply :Boolean;
begin
If FindRecruiter then
begin
If OutOfCredits then
begin
LogOut;
SDebug('Out Of Credits. Logging Out.');
LogOut;
TerminateScript;
end;
Mouse(78, 308, 5, 5, mouse_Left);
Wait(RandomRange(350, 550));
Mouse(327, 226, 5, 5, mouse_Left);
end;
end;
function LadderPointExists(var Ladder :TPoint) :Boolean;
var
TempCTS :Integer;
TPA :TPointArray;
begin
Result := False;
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.64, 3.76);
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 536665, MMX1, MMY1, MMX2, MMY2, 3);
FilterPointsDist(TPA, 0, 75.5, MMCX, MMCY);
if Length(TPA) <> 0 then
begin
Ladder := TPA[0];
Result := True;
end;
ColorToleranceSpeed(TempCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function Walk(Where :String) :Boolean;
var
LadderPoint :TPoint;
begin
SDebug('Walking To ' + Where);
If LadderPointExists(LadderPoint) then
begin
If Where = 'ReSupply' then
Mouse(LadderPoint.X - 35, LadderPoint.Y - 10, 2, 2, mouse_Left)
else
Mouse(LadderPoint.X, LadderPoint.Y + 5, 2, 2, mouse_Left);
end
else
begin
If Where = 'ReSupply' then
Mouse(601, 86, 2, 2, True)
else
Mouse(664, 96, 2, 2, True)
end;
while isMoving do Wait(RandomRange(200, 400));
Flag;
end;
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP, SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP.x + 1, TTP.y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP.x, TTP.y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
procedure DoSmartPrint;
var
Wet, Wst, Cst, Srt, Tih, Tim, Tis, Awt, Sec: Integer;
begin
Cst := GetSystemTime;
Srt := (cst - sst) / 1000;
Tih := srt / 3600;
tim := (srt / 60) - tih * 60;
Tis := srt - tim * 60 - tih * 3600;
Awt := wet - wst
Sec := GetTimeRunning div 1000 + 1;
PrintOnSmart([' Home'#39's Mobilising Armies Suicider 0,1 ' + Ver], Point(15, 30), clRed, 131072);
PrintOnSmart([
'Name : ' + Capitalize(Players[CurrentPlayer].Name),
'',
'Suicide Trips / Hour : ' + IntToStr(Round(3600 * Players[CurrentPlayer].Integers[2] / Sec)),
'',
'Suicide Trips Done : ' + IntToStr(Players[CurrentPlayer].Integers[2]),
'',
'Worked : ' + TimeRunning,
'',
''], Point(20, 60), 1959605, 131072)
end;
procedure PlayerStats;
var
Wet, Wst, Cst, Srt, Tih, Tim, Tis, Awt, Sec: Integer;
begin
Cst := GetSystemTime;
Srt := (cst - sst) / 1000;
Tih := srt / 3600;
tim := (srt / 60) - tih * 60;
Tis := srt - tim * 60 - tih * 3600;
Awt := wet - wst
Sec := GetTimeRunning div 1000 + 1;
Writeln('+++++++++++++++++++++++++++++++++++++++++++++++++++++++');
Writeln(' Home'#39's Mobilising Armies Suicider 0,1 ');
Writeln('+++++++++++++++++++++++++++++++++++++++++++++++++++++++');
writeln('Name : ' + Capitalize(Players[CurrentPlayer].Name));
Writeln('Suicide Trips / Hour : ' + IntToStr(Round(3600 * Players[CurrentPlayer].Integers[2] / Sec)));
Writeln('Suicide Trips Done : ' + IntToStr(Players[CurrentPlayer].Integers[2]));
Writeln('Worked : ' + TimeRunning);
Writeln('Time : ' + TheTime)
Writeln('——————————————————-');
end;
procedure ProgressReport;
begin
PlayerStats;
WriteLn(' ');
DoSmartPrint;
end;
begin
Smart_Server := 39;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
ClearDebug;
SDebug('Welcome To Home''s MA!');
MakeCompass('N');
If Not InBattle then SetAngle(SRL_ANGLE_HIGH);
repeat
GetIn;
WaitRoom;
MobiliseArmy;
WhileInBattle;
If FindLadders then
Inc(Players[CurrentPlayer].Integers[2]);
Walk('ReSupply');
ReSupply;
Walk('Entrance');
ProgressReport;
until(False);
end.