mika
2012-06-13 20:00:01
It was supposed to be a full endurance mode but i ran out of time and moved on. if someone feels like finishing it feel free. Idea was that it could use combat potion and would find which boss its going to fight based on a bitmap of the bosses name on the random boss pick screen. Any questions just pm me. Heres the script:
program Dominion;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i sps/sps.simba}
const
Food = 'Lobster'; //Trout, Tuna, Lobster, Swordfish, Monkfish, Shark
Function RepeatChopTreeTeak: Boolean;Forward;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True;
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
//By Bandland100, modified to shift mouse speeds after every step
procedure SuperWindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX,veloY,windX,windY,veloMag,dist,randomDist,lastDist,step: extended;
lastX,lastY,MSP,W: integer;
sqrt2,sqrt3,sqrt5: extended;
begin
MSP := MouseSpeed;
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
case Random(50) of
1..25: W := (MSP + (Random((MSP/4))));
26..50: W := (MSP - (RandomRange((MSP/2), MSP-1)));
end;
if (W < 1) then
W := 1;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
//W := round((maxWait - minWait) * (step / maxStep) + minWait);
wait(W);
lastdist:= dist;
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
MouseSpeed := MSP;
end;
Procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
var
randSpeed: extended;
X,Y,X2,Y2,A,Dist,MP: integer;
begin
A := MouseSpeed;
GetMousePos(X, Y);
Dist := Distance(X, Y, eX, eY);
MP := Round(Dist/150);
if MP < 0 then
MP := 1;
randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
X2 := RandomRange(eX-(A*MP), eX+(A*MP));
Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
SuperWindMouse(X, Y, X2, Y2, 9, 5, 10.0 / randSpeed, 15.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
GetMousePos(X, Y);
MMouse(eX, eY, ranX, ranY);
MouseSpeed := A;
end;
procedure AntiRandoms;
begin
FindNormalRandoms;
LampSkill := 'woodcutting';
end;
procedure AntiBan;
var
X, Y : Integer;
begin
if not LoggedIn then Exit;
AntiRandoms;
case Random(110) of
2 : begin
Writeln('Antiban RandomRClick');
RandomRClick;
end;
22: begin
Writeln('Antiban HoverSkill');
HoverSkill('woodcutting', False)
end;
24: begin
Writeln('Antiban PickUpMouse');
PickUpMouse;
end;
60: begin
Writeln('Antiban ExamineInv');
ExamineInv;
end;
80: begin
Writeln('Antiban CheckXP');
Mouse(533,62,7,7,true);
Wait(3191 + Random(3575))
Mouse(533,62,7,7,true);
end;
end;
end;
function ClickBank: Boolean;
var
BankColors: TIntegerArray;
X,Y,I,A,M,curCTS,Fails: Integer ;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result:= False;
if not LoggedIn or IsMoving then
Exit;
curCTS := GetColorToleranceSpeed;
BankColors:=[5914251, 14014175];
for I := 0 to 1 do
begin
if (IsMoving) then Exit;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,BankColors[I],MSX1,MSY1,MSX2,MSY2,6 +(i*2));
if Length(TPA) = 0 then Continue;
ColorToleranceSpeed(1);
ATPA:= TPAtoATPAEx(TPA,6,6);
M := High(ATPA);
for A:=0 to M do
begin
if MiddleTPAEx(ATPA[A],X,Y) then
begin
MMouse(X,Y,6,6);
if (WaitUpText('ank',150+Random(150))) then
begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,True);
if DidRedClick then
begin
Result:=True;
ColorToleranceSpeed(curCTS);
Fails:=0;
Exit;
end;
end else
begin
Inc(Fails);
end;
end;
end;
end;
if (Fails > 6) then
Result:=False;
Exit;
end;
procedure ClickRewardChest; //Clicks reward chest
var
x, y, Rewardchest : Integer;
aFound: Extended;
begin
Rewardchest := DTMFromString('mQwAAAHicY2ZgYMhnQWBLRgYGeyA2BuKUaB845gKqg2FGJAwEAN4HBU0=');
if FindDTMRotated(Rewardchest, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) then
begin
Mouse(x, y, 5, 5, true);//FindDTM gives (x, y) as the coordinates of the DTM we made it look for.
Writeln('Clicked chest!');
end;
FreeDTM(Rewardchest);
end;
procedure ClickXPBookMS; //Clicks XP book Main Screen
var
x, y, XPbook : Integer;
begin
XPbook := DTMFromString('mggAAAHicY2NgYEgG4hwgjoSyM4A4F4jFgVgWiOWBmBeIVYBYGIjnWRgBSSYMzMqAHTDiwBAAAKD9BBs=');
if FindDTM(XPbook, X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
HumanMMouse(X, Y, 6, 6);
ClickMouse2(True);
FreeDTM(XPbook);
Exit;
end else
FreeDTM(XPbook);
Exit;
end;
procedure ClickXPBookMI; //Clicks XP book Main Screen
var
x, y, XPbook : Integer;
begin
XPbook := DTMFromString('mggAAAHicY2NgYEgG4hwgjoSyM4A4F4jFgVgWiOWBmBeIVYBYGIjnWRgBSSYMzMqAHTDiwBAAAKD9BBs=');
if FindDTM(XPbook, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
HumanMMouse(X, Y, 6, 6);
ClickMouse2(True);
FreeDTM(XPbook);
Exit;
end else
FreeDTM(XPbook);
Exit;
end;
Procedure WalkToRewardChest;
var
MyPath4: TPointArray;
begin
SPS_Setup(DOMINION, ['0_0']);
MyPath4 := [Point(242, 243), Point(228, 236), Point(222, 210)];
if SPS_WalkPath(MyPath4) then
WriteLn('Walked to reward chest!');
Wait(1267 + Random(795))
end;
Function WalkToBank: Boolean; //Walks from front of face(midle) to bank area infront of steps
var
MyPath2: TPointArray;
begin
SPS_Setup(DOMINION, ['0_0']);
MyPath2 := [Point(212, 215), Point(198, 223)];
if SPS_WalkPath(MyPath2) then
WriteLn('Walked to BANK!');
Exit;
end;
procedure ClickCombatPotion; //Clicks CombatPotion in Main Screen bank must be open
var
x, y, CombatPotionDTM, CombatPotionbmp : Integer;
begin
CombatPotionDTM := DTMFromString('mggAAAHicY2NgYEhmYWCIA+IsII4C4lQgjgfiPkYGhmlA3AXEE4F4OhB3AHHBkmigLiYMzAUksWFGHBgCAMt4B4c=');
CombatPotionbmp := BitmapFromString(3, 3, 'meJybu2fxjK1zp2yaFbeiJHpJQdTC' +
'fCAjZllR9OICANdRDnY=');
if FindDTM(CombatPotionDTM, X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
HumanMMouse(X, Y, 6, 6);
ClickMouse2(True);
Wait(111 + Random(155))
ClickMouse2(True);
Wait(111 + Random(157))
FreeDTM(CombatPotionDTM);
Exit;
end else
if FindBitmapToleranceIn(CombatPotionbmp, x, y, MSX1, MSY1, MSX2, MSY2, 12) then
begin
HumanMMouse(X, Y, 6, 6);
ClickMouse2(True);
Wait(111 + Random(155))
ClickMouse2(True);
Wait(111 + Random(157))
FreeBitmap(CombatPotionbmp);
Exit;
end else
Writeln('No Potions!');
FreeDTM(CombatPotionDTM);
FreeBitmap(CombatPotionbmp);
Exit;
end;
Procedure WithdrawFood;
var
FoodDTM,X,Y,X2,Y2,T: Integer;
begin
if not LoggedIn then Exit;
Case lowercase(Food) of
'trout' : FoodDTM := DTMFromString('mlwAAAHicY2dgYCgD4kIgzgbiAiCuAOJaIG4EYhUgVgRiTSDWBWJtqJg8EGfERAJJJqxYDkjiwox4MBQAALdhBks=');
'tuna' : FoodDTM := DTMFromString('mlwAAAHicY2dgYFAAYikgFgFiCShfHYh1gFgFiOWBWA2I9YBYFyonC8QpEWFAkgkrFoGahw0z4sFQAABkyQOa');
'lobster' : FoodDTM := DTMFromString('mbQAAAHicY2VgYOgB4g4g7gPiyUA8FYjPA/F1IL4CxHeA+DQQrw+TAJJMKJiLARMwYsFgAACaUQgl');
'swordfish' : FoodDTM := DTMFromString('mlwAAAHicY2dgYGhmZGDoBuKJQNwHxJ2MELFyIJZhgGAFIFYCYmUglofSzTFdQJIJK+YCknI4MCMeDAUA/+8G2A==');
'monkfish': FoodDTM := DTMFromString('mggAAAHicY2NgYJjEyMAwEYgXQPE8IJ4GxB+Bct+A+A0DhP0diH8AsbejJcP8miogiwkFcwFJEEYHjDgwBAAAZ90L0w==');
'shark' : FoodDTM := DTMFromString('mggAAAHicY2NgYLBjZGAwB2JHIHYHYg8g1gfiEqBcAxBXA3EzEJcCcQsQd+RHAUkmDMzFgB0w4sAQAAAltwXX');
end;
if FindDTM(FoodDTM, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
HumanMMouse(X, Y, 6, 6);
ClickMouse2(False);
WaitOption('Withdraw-All', 400);
Exit;
end else
if FindDTM(FoodDTM, X, Y, MIX1, MIY1, MIX2, MIY2) then //change to BMP later
begin
WriteLn('Withdraw failed, trying again.');
HumanMMouse(X, Y, 6, 6);
ClickMouse2(False);
WaitOption('Withdraw-All', 400);
Wait(RandomRange(425, 675));
Wait(41 + Random(157))
Exit;
end;
FreeDTM(FoodDTM);
end;
procedure DoBank; //Withdraws Food and combat potions must be near bank will open it
var
x, y : Integer;
begin
if not LoggedIn then Exit;
ClickBank; //opens bank
Wait(1201 + Random(475))
ClickCombatPotion;
Wait(801 + Random(475))
WithdrawFood;
Wait(151 + Random(175))
CloseBank;
Wait(201 + Random(175))
Exit;
end;
procedure FreeBossBitmaps; //frees boss bitmaps
var
Message2, Message3, Message4, Message5, Message6 : Integer;
begin
FreeBitmap(Message2);
Wait(25)
FreeBitmap(Message3);
Wait(25)
FreeBitmap(Message4);
Wait(25)
FreeBitmap(Message5);
Wait(25)
FreeBitmap(Message6);
Wait(25)
Exit;
end;
procedure PrayMelee; //Prays deflect melee and leech defence
begin
GameTab(tab_Prayer);
Wait(25)
Exit;
end;
procedure DoFight; //Claims rewards if any
var
x, y, Message2, Message3, Message4, Message5, Message6 : Integer; //Message 2 is ""
begin
Message2 := BitmapFromString(16, 5, 'me=='); //
Message3 := BitmapFromString(16, 5, 'me=='); //
Message4 := BitmapFromString(16, 5, 'me=='); //
Message5 := BitmapFromString(16, 5, 'me=='); //
Message6 := BitmapFromString(16, 5, 'me=='); //
Wait(randomRange(2000,2500))//wait for screens to cycle so we can find the bitmap
if FindBitmapToleranceIn(Message2, x, y, MSX1, MSY1, MSX2, MSY2, 14) then
begin
if not LoggedIn then Exit;
Writeln('Boss !');
Wait(201)
FreeBossBitmaps;
end else
if FindBitmapToleranceIn(Message3, x, y, MSX1, MSY1, MSX2, MSY2, 14) then
begin
Wait(50)
FreeBossBitmaps;
//boss shit here
end else
if FindBitmapToleranceIn(Message4, x, y, MSX1, MSY1, MSX2, MSY2, 14) then
begin
Wait(50)
FreeBossBitmaps;
//boss shit here
end else
if FindBitmapToleranceIn(Message5, x, y, MSX1, MSY1, MSX2, MSY2, 14) then
begin
Wait(50)
FreeBossBitmaps;
//boss shit here
end else
if FindBitmapToleranceIn(Message6, x, y, MSX1, MSY1, MSX2, MSY2, 14) then
begin
Wait(50)
FreeBossBitmaps;
//boss shit here
end else
begin
Wait(50)
FreeBossBitmaps;
//noraml fite here
end
end;
procedure DoRewards; //Claims rewards if any
var
x, y, Message1 : Integer; //Message one is "You dont have any Dominion factor to claim"
begin
Message1 := BitmapFromString(152, 3, 'meJyVlAEKwjAMRXdlRYY4PI4iso' +
'FXETewBe9i7GNZmnYDx6dkSZr95jfrhtAN4XQfm6aR1WBSo71N+8t' +
'L0N5GsVklJKvsIoSR/L9Ql8oKDveoOQJ5FWgUnB8fkPtjKpVBo2VI' +
'MJNcDJzH65MEQrWyETT5kw47wSQlBMMhbqAsfuoDWDvav5A6lio9r' +
'+m4CKoqJAVHFGTVEGLNXxm1rIbA7vpGSisoCjod10TEqCpoLlIWwo' +
'koG22hM7KSyS0tbx35yV/FkpNdgEVHL3RFdLN9A7BV22oKnEe0s2l' +
'0BqiI+tgjl1HagojlltJ2JO1EuBPZCXIf5YKhi93iZtwRUJI2qjTS' +
'nGYTYcdZFfnZfSgyQ8HBdiM6j6U9/wo82y993OU0');
ClickRewardChest;
Wait(1901 + Random(475))
begin
if FindBitmapToleranceIn(Message1, x, y, MCX1, MCY1, MCX2, MCY2, 12) then
begin
if not LoggedIn then Exit;
Writeln('No rewards!');
Wait(401)
FreeBitmap(Message1);
WalkToBank;
end else
begin
Wait(1121 + Random(375))
Writeln('Rewards!');
ClickXPBookMS;
Wait(701 + Random(255))
Mouse(155, 255, 4, 8, True); //convert items
Wait(801 + Random(255))
ClickXPBookMS;
Wait(301 + Random(175))
Mouse(340, 255, 22, 9, True); //bank all items
FreeBitmap(Message1);
WalkToBank;
end
end
end;
Function EnterDominonTower:Boolean; //Enters dominion tower minigame using stairs
var
Endurance, x, y : Integer;
begin
Endurance := BitmapFromString(19, 3, 'meJxz3PTVcdNXBgYGW2MJIANIQhC' +
'cDWGgSUG0IGuEMJDZEGVABrLhQLalLj9EjaWuAIzBjyQIZUAUQBDE' +
'KAAZoTLV');
Wait(301 + Random(175))
MouseBox(200, 100, 300, 150, 1);//click satairs with mosue box(0 is rite click 1 is left click) 200,100 300,150
Wait(1191 + Random(575))
if FindBitmapToleranceIn(Endurance, x, y, MSX1, MSY1, MSX2, MSY2, 15) then //Remember that MI = Main Inventory.
begin
Writeln('Found Endurance bitmap!');
MMouse(x, y, 0, 0);
Wait(200 + Random(100));
//if IsUpText('elect') then
begin
Wait(200 + Random(100));
Mouse(x, y, 4, 10, True);
Wait(2000 + Random(500));
Result := True;
FreeBitmap(Endurance);
Exit;
end // else
// begin
// Writeln('Couldn''t find the Endurance.');
// FreeBitmap(Endurance);
// Exit;
// end;
end;
end;
Function SelectFight:Boolean; //Clicks the Fight button after the random selection of boss
var
Fight, x, y : Integer;
begin
Fight := BitmapFromString(15, 5, 'meJxjE01gw0COm74yMDBgCrJJJgN' +
'JCAKyIQiiGFMQxJXOYQADCBuIkMXRBIEi7LLFQARnQxjIbAgDylao' +
'AiI4G8pQrAIiZEEAwflDBA==');
if FindBitmapToleranceIn(Fight, x, y, MSX1, MSY1, MSX2, MSY2, 15) then //Remember that MI = Main Inventory.
begin
Writeln('Found Fight bitmap!');
MMouse(x, y, 0, 0);
Wait(200 + Random(100));
//if IsUpText('elect') then
begin
Wait(200 + Random(100));
Mouse(x, y, 6, 10, True);
Result := True;
FreeBitmap(Fight);
Exit;
end // else
// begin
// Writeln('Couldn''t find the Endurance.');
// FreeBitmap(Fight);
// Exit;
// end;
end;
end;
Function WalkToStairs: Boolean; // walks to stairs to begin playing minigame
var
MyPath3: TPointArray;
begin
SPS_Setup(DOMINION, ['0_0']);
MyPath3 := [Point(208, 223), Point(209, 205), Point(206, 189), Point(201, 177)];
if SPS_WalkPath(MyPath3) then
WriteLn('Walked to stairs!');
Wait(287 + Random(175))
Exit;
end;
Function ClickLogsTeak: Boolean;
var
Teak, x, y : Integer;{Declared locally this time because we are only using it in this function. :)
We also need to declare 'x, y' so that the coordinates of the bitmap can be stored in them}
begin
Teak := BitmapFromString(5, 5, 'meJwr23gpecqGpEnrEieuSZiwumjV' +
'KSAZ37cyrne5U3Kpb0mXT3GHd2EbEHnltwJVhjbMgKCQ+mmFK09mL' +
'9gX07UEggC9FyY0');
if FindBitmapToleranceIn(Teak, x, y, MSX1, MSY1, MSX2, MSY2, 12) then
begin
Writeln('Found log bitmap!');
MMouse(x, y, 0, 0);
Wait(200 + Random(100));
if IsUpText('eak') then
begin
Wait(200 + Random(100));
Mouse(x, y, 6, 6, False);
(waitOptionMulti(['ll', 'All'], 500+ Random(211)));
Result := True;
end else
begin
if not LoggedIn then Exit;
if FindObjCustom(x, y, ['eak', 'ogs'], [6196390, 6328491], 25) then
begin
Mouse(x, y, 0, 0, False);
waitOptionMulti(['ll', 'All'], (500+ Random(211)));
Result := True;
end else
Writeln('Couldn''t find the log.');
end;
end else
Writeln('Couldn''t find the log bitmap');
FreeBitmap(Teak);
end;
procedure Report;
begin
ClearDebug;
WriteLn('==================Dominion=Endurance=By=Mika=========================');
WriteLn('Time Running: '+TimeRunning);
WriteLn('=====================================================================');
end;
Function SpecialAttack:Boolean;
var
x, y : Integer;
begin
GameTab(tab_Combat);
Wait(501 + Random(205))
if FindColorTolerance (x, y, 8241037, 589, 417, 591, 419, 15) then
begin
Wait(101 + Random(175))
Mouse(640,425,25,4,true);
end;
end;
Function RepeatChopTreeTeak: Boolean;
var
numberOfWaits: Integer;
begin
repeat
Wait(2001 + Random(175))
AntiBan;
Wait(10901 + Random(4175))
Inc(numberOfWaits);
Writeln('We have chopped ' + IntToStr(numberOfWaits) + ' times');
until((InvFull) or (numberOfWaits = 8));
Wait(4195 + random(600));
end;
begin
Smart_Server := 60;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
Wait(201 + Random(50));
Setangle(0)
WalkToRewardChest;
Wait(1501 + Random(250));
DoRewards;
Wait(401 + Random(250));
WalkToBank;
Wait(1701 + Random(250));
DoBank;
Wait(301 + Random(250));
WalkToStairs;
Wait(301 + Random(250));
EnterDominonTower;
Wait(2001 + Random(550));
SelectFight;
end.