SRL Archive - First Scripts

Thieves Guild - Coshing Script


Pierite

2014-02-13 01:48:34

Hi,

I saw the script from 'Wu Tang Gang' and thought it could use some improvement.

Lvl 70 test == 100k exp / hour

I ended up extending the script with:

1. AntiBan functions.
2. Knock out failure detection.
3. Works on volunteers in a different area (less suspicious).
4. reliable and able to recover (8-10 hours of testing).
5. Much faster exp/hour.
6. Much less redundant clicking, less bot like.
7. Many more random waits (which actually result in less overall waiting).

So here's a new and improved version, I have credited all code sections that I used as inspiration for each function,
Where no author is defined, the code is either mine or heavily modified.

There are a couple of things to set it up:

First you'll have to get the volunteer into the following position:
[ATTACH=CONFIG]22924[/ATTACH]

Or Put the advanced trainer in the same position as the other scripts and change line 191
from minimap.setAngle(MM_DIRECTION_SOUTH);
to minimap.setAngle(MM_DIRECTION_NORTH);

Next you'll need to eyedrop the colour of the volunteers vest / Trainers Scarf into "SearchColour".

Version 1.1

program Cosher;

{$Define SMART}
{$I SRL-6/SRL.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
{$I SPS/lib/SPS-RS3.Simba}

// -----------------------------------------------------------------------------
// --------- customize user values here ------------------
// -----------------------------------------------------------------------------
var
StartingXP : Integer;
FoundColours : TPointArray;
SortedColours : T2DPointArray;
SearchBox : TBox;

const
MiniBreak := 20000;
MiniBreakDelta := 15000;
MiniBreakChance := 6;

SessionTime := 240;

SearchColour := 3161931;
BirdColour := 4521983;
ColourAdj := ColorSetting(2, 0.05, 0.18);

MM_DIR := MM_DIRECTION_NORTH;

// -----------------------------------------------------------------------------
// FindVolunteer()
//
// Attmepts to find the trainer and lure him
// -----------------------------------------------------------------------------
function FindVolunteer: Boolean;
var
i, h: Integer;
p: Tpoint;
begin

FindColorsTolerance(FoundColours, SearchColour, SearchBox, 7, ColourAdj);

if (Length(FoundColours) < 1) then
begin
Writeln('Volunteer Not Found');
Exit(false);
end;

SortedColours := FoundColours.ToATPA(20, 20);
SortATPAFromMidPoint(SortedColours, Point(randomRange(mainscreen.playerpoint.x,
mainscreen.playerpoint.x), mainscreen.playerpoint.y));

h := High(SortedColours);

for i := 0 to h do
begin
if (Length(SortedColours[i]) < 50) then
Continue;

Mouse(SortedColours[i][random(High(SortedColours[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['alk', '-to', 'Cosh', 'volun', 'teer'], 500) then
begin
fastclick(mouse_right);
Wait(450+RandomRange(50,100));
chooseOption._select(['ure', 'Lure'], MOUSE_LEFT, true, 1.00, 300);

Wait(500+RandomRange(500,1000));
Exit(true);
end
else
begin
Writeln('Volunteer Not Found');
Exit(false);
end;
end;
end;

// -----------------------------------------------------------------------------
// GoThruChat()
//
// If we are chatting navigate out of the chat and return true.
// If we are not chatting (lure failed), return false.
// -----------------------------------------------------------------------------
function GoThruChat : Boolean;
begin
if (conversationBox.areTalking()) then
begin
conversationBox.continue(true, true);
Wait(200+Random(100));

conversationBox.continue(true, true);
Wait(500+Random(100));
Exit(true);
end;
Exit(false);
end;

// -----------------------------------------------------------------------------
// KnockKnock()
//
// Attempts to knock out the trainer after he has been lured.
// -----------------------------------------------------------------------------
function KnockKnock: Boolean;
var
i, h: Integer;
t: TTimeMarker;
begin


FindColorsTolerance(FoundColours, SearchColour, SearchBox, 7, ColourAdj);

if (Length(FoundColours) < 1) then
Exit;

SortedColours := FoundColours.ToATPA(20, 20);
SortATPAFromMidPoint(SortedColours, Point(randomRange(mainscreen.playerpoint.x,
mainscreen.playerpoint.x), mainscreen.playerpoint.y));

h := High(SortedColours);

for i := 0 to h do
begin
if (Length(SortedColours[i]) < 50) then
Continue;

Mouse(SortedColours[i][random(High(SortedColours[i]))], MOUSE_MOVE, MOUSE_HUMAN);
if IsMouseOverText(['alk', '-to', 'Cosh', 'volun', 'teer'], 500) then
begin
fastclick(mouse_right);
Wait(500);
chooseOption._select(['nock', '-out'], MOUSE_LEFT, true, 1.00, 300);
Exit(true);
end
else
begin
Writeln('Volunteer Not Found');
Exit(false);
end;
end;
end;


// -----------------------------------------------------------------------------
// TripleLoot()
//
// Spam quick option selects for looting.
// The fifth click has a 70% change of going off.
// -----------------------------------------------------------------------------
function TripleLoot : Boolean;
var
MouseX, MouseY : Integer;
begin
mouseSpeed := 35;

mouse(365, 217, 15, 10, MOUSE_RIGHT);
chooseOption.select(['oot']);
Wait(5+RandomRange(4,15));

mouse(365, 217, 15, 10, MOUSE_RIGHT);
chooseOption.select(['oot']);
Wait(5+RandomRange(4,15));

FindColorsTolerance(FoundColours, BirdColour, SearchBox, 8, ColourAdj);
if (Length(FoundColours) >= 1) then
begin
writeln('Failed Knocking out');
Exit(false);
end;

mouse(365, 217, 15, 10, MOUSE_RIGHT);
chooseOption.select(['oot']);
Wait(5+RandomRange(4,15));

mouse(365, 217, 15, 10, MOUSE_RIGHT);
chooseOption.select(['oot']);
Wait(5+RandomRange(4,15));

mouse(365, 217, 15, 10, MOUSE_RIGHT);
chooseOption.select(['oot']);
Wait(5+RandomRange(4,15));

mouseSpeed := 20;

Exit(True);
end;

// -----------------------------------------------------------------------------
// fixScreenSettings()
//
// Tries to set the screen the way we want it
// Adapted from bonsaiPowerMiner
// -----------------------------------------------------------------------------
procedure fixScreenSettings();
begin
mainscreen.setZoom(false);
mainscreen.setangle(MS_ANGLE_HIGH);
minimap.setAngle(MM_DIR);
end;

// -----------------------------------------------------------------------------
// AntiBan()
//
// Performs random Anti-Ban movements
// Adapted from limoCosher
// -----------------------------------------------------------------------------
procedure AntiBan;
begin
Case Random(200) Of
1: begin
writeln('Antiban activated: Hovering Thieving.');
HoverSkill(SKILL_THIEVING);
end;
2: begin
writeln('Antiban activated: Hovering random skill.');
hoverRandomSkill();
end;
3: begin
writeln('Antiban activated: Bored Human.');
Boredhuman();
end;
4: begin
writeln('Antiban activated: MiniWait');
Wait(2500 + random(4500));
end;
6: begin
writeln('Antiban activated: PickUpMouse');
PickUpMouse();
end;
7: begin
writeln('Antiban activated: Random Movement');
wait(randomRange(400,900));
smallRandomMouse(randomRange(50, 230));
wait(randomRange(400,900));
end;
8: begin
writeln('Antiban activated: RandomRClick');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(5500, 10400));
end;
end;
end;

// -----------------------------------------------------------------------------
// mainFunction()
//
// main loop that runs the program
// -----------------------------------------------------------------------------
var
found, i : Boolean;
TotalBreak, fail : Integer;
begin
fail := 0;
disableSRLDebug := true;

SetupSRL();
fixScreenSettings();

SearchBox := IntToBox(
mainscreen.playerpoint.x-140,
mainscreen.playerpoint.y-70,
mainscreen.playerpoint.x+200,
mainscreen.y2
);

while (true) do
begin
if(fail > 10) then
begin
Writeln('Too many failures, Exiting');
Break;
end;
if(GetTimeRunning() >= SessionTime*60000) then
begin
writeln('Session Ended');
Exit();
end;

found := FindVolunteer();
Wait(350+RandomRange(20,350));

if(found = true) then
begin
if(GoThruChat() = true) then
begin
Wait(100+RandomRange(50,150));

KnockKnock();
Wait(700+RandomRange(50,100));

if(TripleLoot() = true) then
begin
Wait(950+RandomRange(100,200));
fail := 0;
end
else
Wait(3050+RandomRange(100,400));
end
else
Wait(1000+RandomRange(500,1000));
end
else
begin
fail := fail + 1;
Writeln('Failed: ', fail, ' times');
end;

if(RandomRange(1,200) < MiniBreakChance) then
begin
TotalBreak := MiniBreak+Random(MiniBreakDelta);
Writeln('MiniBreak Active For: ', TotalBreak, 'ms');
Wait(TotalBreak);
end;

AntiBan();
end;
end.

That's it!
Enjoy.

Be sure to tell me about any bugs, this is my first script / fixer-upper.

Pierite

2014-02-23 06:11:32

Hi all, version 1.1 is now up,
I've done the speed fixes to the looting, it should now loot 3 times per knockout at a rate of about 70%~~.
Also added an auto-fail mode where the script will finish if it detects 10 failures in a row (will happen if volunteer moves away).
I've never had to change the bird search colour, so you don't have to either.
I've added the mini-map direction to a constant up the top to make it easier to change.

Because of the new speed changes I would not recommend running this script for more than 3 hours.

Wu-Tang Clan

2014-02-23 08:53:49

Nice job! You should post this in the thieving section of scripts instead of first scripts. My script was whipped up quickly, but yours sounds like it has a lot of potential! Great job on your script and hope to see more in the future.

Sjoe

2014-02-23 09:14:32

From: Wu-Tang Clan
Nice job! You should post this in the thieving section of scripts instead of first scripts. My script was whipped up quickly, but yours sounds like it has a lot of potential! Great job on your script and hope to see more in the future.


Wu Tang Gang roflol, u gonna let that one slip?

Wu-Tang Clan

2014-02-23 09:17:20

From: Sjoe
Wu Tang Gang roflol, u gonna let that one slip?

I'll keep working on mine, but seeing as somebody else has seized the moment, I am letting them enjoy it..
So yes, I will let this one "slip" while I release my Dungeoneering script
I'm also going to forget that he said Wu-Tang Gang instead of Wu-Tang Clan

Pierite

2014-02-24 03:03:06

Oops sorry! I didn't realise that it was clan instead of gang! Sorry about that.

I put this script in first scripts just in case you had a problem with it :P,
Didn't want to step on any toes with my first post!

Hope the dungeoneering script is going well! I'll move this into thieving scripts when i get the chance :D.

Also, your script wasn't bad, it had tonnes of potential, which is what made me pick it for improving,
bad scripts just aren't worth messing with.