- Added the bit in ToSafe mentioned above
- Line 360 of the version posted by Main_Ftw,
MMouse(x, y, 4, 4); changed to
MMouse(x, y, 0, 0);, as after checking uptext before every click it would move the mouse a tiny bit, then click - just something annoying that could be detected, imo.
- Line 354 changed randomness from 0,0 to 4,4. I think what was happening was it would move the mouse to the exact colour found, then move it randomly a bit before clicking. Now it moves it to the spot with randomness, and doesnt move it before clicking.
- Put if not CheckAndRestoreHealth then break; above the StethoScope Click in main loop so it wouldnt use stethoscope on lobsters if it needed to eat.
Safe object finding could use some work, especially when theres people around - if someone is at the safe the mouse moves to, the uptext is different and it doesnt right click. Tried using a right click and ChooseOption but it appears to be broken and cbf coming up with a solution atm.
<============== - Progress Report ===============>
Worked for 15 Minutes and 14 Seconds
Thieving Level 60
Gained 4270 Xp
Banked 1 Times
Cracked 61 Safes
Failed 11 Safes
Ate 11 lobsters
Banked 5 Sapphires
Banked 8 Emeralds
Banked 4 Rubies
Banked 0 Diamonds
56k of loot, minus the 3k of lobbies = 212k gp/hour, approx 17k thieving xp/hour at lvl 60 with a stethoscope. Not bad overall :p
//----------------------------------------------------------------------------//
// *
// * NAME : Safe Cracker
// * WRITER : WT-Fakawi
// * CATEGORY : Collecting/Banking
// * DESCRIPTION : Cracks safes and banks Gems. USES STETHOSCOPE IF WIELDED!!!
// * USAGE : Sample the Safe Color, the brown outline color! LINE 32
// * Start near Benedict, Face Down. Make Sure BankSymbol
// * is uncovered.
// * AUTOCOLOR : NO.
// * NOTES : SRL 4
// * DATE : rereleased @ 10-01-2010
//----------------------------------------------------------------------------//
// 1. USE the DEFAULT Runescape Client with Low Detail, Very Bright.
// 2. Set your Screen to 32 bit TRUE color.
// 3. Find yourself a quiet World.
// 4. Position your char near Benedict at Burthorpe Pub's cellar
// 5. Buy a Stethoscope @ Martin to increase chances.
// --- If you can't, set Stethoscope to False (Line 34)
// 6. Have Lostera visible in upper bankslot
//-------------------------------------------------------------- --------------//
program SafeCracker;
//{.include SRL/SRL/Misc/Smart.scar}
{.include SRL/SRL.scar}
// SAMPLE THE BROWN OUTLINE OF THE SAFE
Const SafeColor = 3026480; // <- replace this number with the current safe color!!!!
// SAMPLE THE BROWN OUTLINE OF THE SAFE
Const TheFood = 'lobster'; // one choices for now: 'lobster'
Const Stethoscope = True; // Buy a Stethoscope @ Martin for better cracking!!!
Const VersionNumber = '0.35';
const RemoteMaster = ''; //<- fill in the Nickname of the RC master
const MySRLID = ''; //<- Your SRLID. Leave blank if you dont have one.
const MySRLPassword = ''; //<- Your SRL Password here if you want to have yout stats logged
const FawkiDebug = False;
var
Sapphires, Emeralds, Rubies, Diamonds, Fails,Cracks, Ate,
MMCrackSafe3, Start, Emergency, Food, Dumx, Dumy, FoodHeals, FoodLeft,
Damage, HPAmount, HPLevel, ThievingLevel, CrackSafeDTM,StethosMask :Integer;
//----------------------------------------------------------------------------//
Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active := True;
end;
//----------------------------------------------------------------------------//
Procedure WTDown;
Begin
KeyDown(VK_DOWN);
Wait(2500 + Random(1000));
KeyUp(VK_DOWN);
End;
//----------------------------------------------------------------------------//
Procedure WTUp;
Begin
KeyDown(VK_UP);
Wait(2500 + Random(1000));
KeyUp(VK_UP);
End;
//----------------------------------------------------------------------------//
procedure ProgressReport;
begin
begin
writeln(' ');
writeln('<============== - Progress Report ===============>');
writeln('Worked for '+ TimeRunning);
writeln('Thieving Level '+ IntToStr(ThievingLevel));
writeln('Gained '+ IntToStr(Cracks * 70)+ ' Xp');
writeln('Banked '+ IntToStr(Banks)+ ' Times');
writeln('Cracked '+ IntToStr(Cracks)+ ' Safes');
writeln('Failed '+ IntToStr(Fails)+ ' Safes');
writeln('Ate '+ IntToStr(Ate)+ ' ' + TheFood + 's');
writeln('Banked '+ IntToStr(Sapphires)+ ' Sapphires');
writeln('Banked '+ IntToStr(Emeralds)+ ' Emeralds');
writeln('Banked '+ IntToStr(Rubies)+ ' Rubies');
writeln('Banked '+ IntToStr(Diamonds)+ ' Diamonds');
writeln(' ');
end;
end;
//----------------------------------------------------------------------------//
procedure LoadCSBitmaps;
begin
MMCrackSafe3 := BitmapFromString(20, 1, 'beNp79fzlKwTycpCH' +
'I8LiAKnkJgE=');
CrackSafeDTM := DTMFromString('78DA635CC8C4C010C500068C108A21CC4B85E' +
'13F94FF1F08181700D584A3AA79F9EA398311129F7131116AE663' +
'AAF172904755B3840835B389B06B05116A961361D71CC26A00431' +
'71DC8');
StethosMask := BitmapFromString(28, 22, 'beNrF1UEKACAIBED//' +
'2mDDhFpWqviHiMnkCwiODxDeVlaonw4KbIqBNlbOczahQBbDUrh11' +
'RB9xTjbhu1vEVdlAGaFuxA3HxvV6PZu7Oi7UVmxRS7hZGHUR2clK/' +
'BnU0nA3D+yzU=');
end;
//----------------------------------------------------------------------------//
Function HaveStethos:Boolean;
var
x,y:Integer;
begin
Result := FindBitMapMaskTolerance(StethosMask, x, y, MIx1, MIy1, Mix2, MIy2, 50, 50);
end;
//----------------------------------------------------------------------------//
Function ClickStethos:Boolean;
var
x,y:Integer;
begin
if FindBitMapMaskTolerance(StethosMask, x, y, MIx1, MIy1, Mix2, MIy2, 50, 50) then
begin
MoveMouse((x + 14) - Random(14) + Random(14),(y + 14) - Random(14) + Random(14));
GetMousePos(x,y);
Mouse(x, y,0,0, True);
Result := True;
end
end;
//----------------------------------------------------------------------------//
procedure SetFood(WhatFood:String);
begin
case WhatFood of
'lobster':
Begin
Food := BitmapFromString(10, 13, 'beNpjYMAD/v//j5WNJ' +
'oIpBRGEADwm45HFJUW5LC41BL1DqizWEMAeLABkblmn');
FoodHeals := 12;
End;
'salmon':
Begin
Food := BitmapFromString2(False, 'a0AA9478DACDD04B0A80300' + // = old bitmap; needs to be updated!
'C04D02B4D3F69B3556BEF7F2433D92808A29482593C0A69261000' +
'68D1802E467625EF7457DA8B5902FF1464332A15D9CEAE078826B' +
'E6B306B64B7A646A553CF4C2A66587D00E85E9850D7E4195BEE99' +
'B3B7FCFF56FDB1C66F3532F5BEBEE61FA70');
FoodHeals := 9;
End;
end;
end;
//----------------------------------------------------------------------------//
Function HaveFood(var Lx, Ly:Integer): Boolean;
var Dx, Dy:integer;
begin
if FawkiDebug then writeln('into HaveFood');
GameTab(tab_Inv);
FoodLeft := CountItems('mask', Food, [20]);
if FawkiDebug then writeln('food left =' + IntToStr(FoodLeft));
if FindBitmapMaskTolerance(Food,Dx, Dy, MIX1, MIY1, MIX2, MIY2, 20, 20) then
begin
if FawkiDebug then writeln('Found Food Bitmapmask');
Lx := Dx;
Ly := Dy;
Result := True;
end
else
begin
Result := False;
if FawkiDebug then writeln('NOT Found Food Bitmapmask');
end;
end;
//----------------------------------------------------------------------------//
procedure Quit(reason:String);
begin
Logout;
writeln(reason);
TerminateScript;
end;
//----------------------------------------------------------------------------//
function CountItemCol(Col: Integer): Integer;
var
i, x, y: Integer;
TB: Tbox;
begin
for i := 1 to 28 do
begin
TB := InvBox(i);
if ExistsItem(i) then
if FindColorTolerance(x, y, Col, TB.x1, TB.y1, TB.x2, TB.y2, 20) then
Inc(Result);
end;
end;
//----------------------------------------------------------------------------//
Procedure CountLoot;
var
Sb, Eb, Rb, Db:Integer;
begin
Sb := CountItemCol(9573906);
Eb := CountItemCol(1477648);
Rb := CountItemCol(858746);
Db := CountItemCol(11776948);
if Fawkidebug then writeln(' ');
if Fawkidebug then writeln(IntToStr(Sb) + ' Sapphires' );
if Fawkidebug then writeln(IntToStr(Eb) + ' Emeralds' );
if Fawkidebug then writeln(IntToStr(Rb) + ' Rubies' );
if Fawkidebug then writeln(IntToStr(Db) + ' Diamonds' );
end;
//----------------------------------------------------------------------------//
// Waits and performs FindRandoms. I call this procedure as much as possible!!!
//----------------------------------------------------------------------------//
procedure FTWait(myLen:Integer);
var mywait: Integer;
begin
for mywait := 0 to myLen do
begin
Wait(100 + Random(100));
FindNormalRandoms;
end
end;
//----------------------------------------------------------------------------//
// Walks to the Safe spot. Uses a DTMRotated. If not found uses blind click.
//----------------------------------------------------------------------------//
Function ToSafe:Boolean;
var
Gx, Gy:Integer;
Calx, Caly:Integer;
WhichAngle: Extended;
begin
MakeCompass('N');
Gx := 711;
Gy := 100;
if FindDtmRotated(CrackSafeDTM, CALx, CALy, 679, 85, 696, 105, -pi/4, pi/4, 0.1,
WhichAngle) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
if FawkiDebug then writeln('FindDtmRotated returded True');
MFF(CALx, CALy , 0, 10);
FFlag(0);
FTWait(4);
Result := True;
Exit;
end;
end
else
begin
if FawkiDebug then writeln('FindDtmRotated returded False');
end;
if FindBitmapSpiralTolerance(MMCrackSafe3, Gx, Gy, MMCx, MMy1, MMX2, MMY2, 20) then
begin
if FawkiDebug then writeln('MMCrackSafe3 bitmap found');
MFF(Gx + 10, Gy , 0, 10);
FFlag(0);
FTWait(4);
Result := True;
Exit;
end
else
begin
if FawkiDebug then writeln('bitmap not found. Blind click.');
MFF(683 + Random(4), 98 + Random(4), 0, 1);
FFlag(0);
Wait(500 + Random(250));
Result := True;
end;
end;
//----------------------------------------------------------------------------//
// Temp UpText checker. Looks for 'l' bitmap. If not found looks for uptext (when fixed)
//----------------------------------------------------------------------------//
Function IsSafeUptext:Boolean;
var
SingleL,x,y: Integer;
Begin
SingleL := BitmapFromString(2, 10, 'beNq7cpn/3nUgErh3g+kKiA' +
'0kIWwIyX3rCiOM5LsLkkWQACnKIkY=');
if FindBitmapToleranceIn(SingleL,x,y,MSx1,MSy1, 200,23,50) then
begin
Result := True;
if FawkiDebug then writeln('bitmap L found');
FreeBitmap(SingleL);
Exit;
End;
if FindColorTolerance(x, y, 14212624, 42, 8, 220, 21, 50) then // Blue
begin
FTwait(1);
if IsTextInAreaEx(7, 7, 160, 20, Dumx, Dumy, 'safe', 100, upchars, True, True, 0, 2, -1) then
begin
Result := True;
if FawkiDebug then writeln('safeuptext found');
FreeBitmap(SingleL);
Exit;
end;
End;
FreeBitmap(SingleL);
Result := False;
End;
//----------------------------------------------------------------------------//
// Clicks on Safe using Spiral. Wont move the mouse is uptext is stil there. Humanlike
//----------------------------------------------------------------------------//
Function ClickSafe:Boolean;
var
x, y :integer;
begin
if IsSafeUptext then
begin
if FawkiDebug then writeln('safeuptext found');
GetMousePos(x, y);
Mouse(x, y,0,0, True);
FTWait(5);
Result := True;
Exit;
end
else
begin
if FindColorSpiralTolerance(x, y, SafeColor, MSx1, MSy1, MSx2, MSy2, 0) then
begin
if FawkiDebug then writeln('SafeColor found');
MMouse(x, y, 4, 4);
GetMousePos(x, y);
FTWait(5);
if IsSafeUptext then
begin
if FawkiDebug then writeln('safeuptext found');
MMouse(x, y, 0, 0);
GetMousePos(x, y);
Mouse(x, y,0,0, True);
Result := True;
end
else
begin
if FawkiDebug then writeln('safeuptext not found');
Result := False;
end;
end;
end;
end;
//----------------------------------------------------------------------------//
// Clicks on Safe using MiddleOfTPA. Wont move the mouse is uptext is stil there.
//----------------------------------------------------------------------------//
Function ClickSafeTPA:Boolean;
var
x, y :integer;
TPP: Tpoint;
TheSafe:TpointArray;
begin
if IsSafeUptext then
begin
if FawkiDebug then writeln('safeuptext found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Result := True;
FTWait(5);
Exit;
end;
if FindColorsSpiralTolerance(MSCx, MSCy, TheSafe, SafeColor, 200, 90, 290 ,160, 0) then
begin
if FawkiDebug then writeln('SafeTPA found');
TPP := MiddleTPA(TheSafe);
MMouse(TPP.x, TPP.y, 0, 0);
if FawkiDebug then writeln('Pointing to Middle TPA');
GetMousePos(x, y);
FTWait(5);
if IsSafeUptext then
begin
if FawkiDebug then writeln('safeuptext found');
MMouse(x, y, 4, 4);
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Result := True;
end
else
begin
Result := False;
if FawkiDebug then writeln('SafeTPA not found');
end;
end
end;
// -------------------------------------------------------------------------- //
Function ClickBankSymbol:Boolean;
var
CalX, CalY: Integer;
begin
If FindColor(CALx, CALy, BankColor, MMX1, MMY1, MMX2, MMY2) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
Result := True;
MFF(CALx, CALy, 1, 1);
FFlag(0);
FTWait(1);
Result := True;
end
else
Result := False;
end;
end;
//----------------------------------------------------------------------------//
// Persisten Benedict Finder. Rotates Cam if Ben is not found and tries again
//----------------------------------------------------------------------------//
Function FindBenedict:Boolean;
var {Dmx, Dmy, }Ax, Ay, x, STime, ETime,TTime, Dumx, Dumy: integer;
Benedict :array[1..4] of integer;
RW, RS:Boolean;
begin
STime := GetSystemTime;
Benedict[1] := 1453619;
Benedict[2] := 2312273;
Benedict[3] := 2114122;
Benedict[4] := 1319469;
repeat
for x := 1 to 4 do
begin
if not LoggedIn then Exit;
// Ax := MSCx - (MSCx - MSx1) + Random(MSCx - MSx1);
// Ay := MScy - (MSCY - MSy1) + Random((MSCY - MSy1));
Ax := MSCx;
Ay := MScy;
ETime := GetSystemTime;
FTWait(4);
if FindColorSpiralTolerance(Ax, Ay, Benedict[x], MSx1, MSy1, MSx2, MSy2, 5) then
begin
MMouse(Ax, Ay, 2, 2);
GetMousePos(Ax, Ay);
FTwait(4);
if FindColorTolerance(Dumx, Dumy, 118992, 42, 8, 120, 21, 50) then // Yellow
begin
FTwait(4);
if IsTextInAreaEx(7, 7, 160, 20, Dumx, Dumy, 'mer', 100, upchars, True,
True, 0, 2, -1) then
begin
Mouse(Ax, Ay,0,0, False);
if Chooseoption('Bank') then
begin
TTime := GetSystemTime;
Repeat
Wait(1000);
Until BankScreen or (GetSystemTime - TTime > 15000)
if BankScreen then
begin
Result := True;
Exit;
end
else Break;
end
end;
end;
end;
end;
Wait(100);
if ETime-STime > 10000 then // After 10 seconds face West
begin
if not RW then
begin
ClickBankSymbol;
MakeCompass('W');
RW := True;
x := 1;
end;
end;
if ETime-STime > 25000 then // After 25 seconds face South
begin
if not RS then
begin
ClickBankSymbol;
MakeCompass('S');
WTDown;
RS := True;
x := 1;
end;
end;
until(ETime-STime > 40000);
Result := False;
end;
//----------------------------------------------------------------------------//
Function ToBank:Boolean;
begin
if ClickBankSymbol then
begin
Result := True;
Exit;
end
else
begin
MFF(600 + Random(4), 88 + Random(4), -1, 0);
FFlag(10);
if ClickBankSymbol then
begin
Result := True;
Exit;
end
else
Result := False;
end
end;
//----------------------------------------------------------------------------//
// Temp SmallChar Reader. Can be replaced if SRL-GetBlackChatMessage works again.
//----------------------------------------------------------------------------//
function WT2GetChatBoxText: string; // temp Smallchars Reader
begin
Result:= GetTextAtEx(14, 443, 0, SmallChars, False, False, 0, 1, 0, 80, False, tr_AllChars);
end;
//----------------------------------------------------------------------------//
Function WaitSafe:Boolean;
var
OBCM, NBCM: String;
TimeOut:Integer;
begin
FFlag(0);
FTWait(12);
OBCM:= WT2GetChatBoxText;
if FawkiDebug then writeln('OBCMgetblackchatmessage = ' + OBCM);
if Pos('start', OBCM) <> 0 then
begin
FTWait(12);
TimeOut := GetSystemTime;
repeat
NBCM := WT2GetChatBoxText;
if FawkiDebug then writeln('NBCM getblackchatmessage = ' + NBCM);
FTWait(2);
if OBCM <> NBCM then
begin
if Pos('slip', NBCM) <> 0 then
begin
Result:= False;
Inc(Fails);
Exit;
end;
if Pos('loot', NBCM) <> 0 then
begin
Result:= True;
Inc(Cracks);
Exit;
end;
end;
if Random(25) = 1 then
begin
IdleTime(2500, 2500, 0.6);
FindNormalRandoms;
End;
until GetSystemTime - TimeOut > 8000;
end;
end;
//----------------------------------------------------------------------------//
// Banks and withdraws 10 Lobsters. Unless you Thieving level = above 90
// leave it at 10 lobsters.
// If you have a stethoscope (buy from Martin nearby) it will keep this in invent
//----------------------------------------------------------------------------//
Function Bank:Boolean;
var
Dx, Dy:integer;
var
Sb, Eb, Rb, Db:Integer;
begin
Fixbank;
Sb := CountItemCol(9573906);
Eb := CountItemCol(1477648);
Rb := CountItemCol(858746);
Db := CountItemCol(11776948);
Sapphires := Sb + Sapphires;
Emeralds := Eb + Emeralds;
Rubies := Rb + Rubies;
Diamonds := Db + Diamonds;
if HaveStethos = True then Deposit(2,28, True) else DepositAll;
ProgressReport;
FTWait(10);
if FindBitmapMaskTolerance(Food,Dx, Dy, MSX1, MSY1, MSX2, MSY2, 20, 20) then
begin
Mouse(Dx, Dy, 4, 4, False);
ChooseOption('10');
Inc(Banks);
Reportvars[0] := 1;
Result := True;
CloseBank;
end
else
begin
if FawkiDebug then writeln('cant find food');
Result := False;
end;
end;
//----------------------------------------------------------------------------//
// No more damagable creatures in runescape...but still....you never know :)
//----------------------------------------------------------------------------//
procedure RunAway2;
begin
RunAway('N', False, 2, 6000);
FTWait(8);
Logout;
Terminatescript;
end;
//----------------------------------------------------------------------------//
// Checks HP and will eat if damage is more then foodvalue.
//----------------------------------------------------------------------------//
Function CheckAndRestoreHealth: Boolean;
var
Lx, Ly:Integer;
var
HPColor: String;
begin
HPAmount:= GetMMlevels( 'hp', hpcolor);
Damage := HPLevel - HPAmount;
if FawkiDebug then writeln('CheckAndRestoreHealth: Damage = ' + IntToStr(Damage));
Result := True;
if Damage >= FoodHeals then
begin
if HaveFood(Lx,Ly) then
begin
{ MMouse(Lx + Random(4), Ly + Random(4),0,0);
GetMousePos(Lx, Ly);
if IsUpText('se') then
Mouse(Lx, Ly, 0, 0, True);
Mouse(Lx, Ly, 0, 0, True);}
Mouse(Lx + Random(4), Ly + Random(4),0,0, True);
Inc(Ate);
FTWait(12);
CountLoot;
end
else
Result := False;
end;
if Damage > 30 then Runaway2;
end;
//----------------------------------------------------------------------------//
procedure Setup;
var
i:Integer;
begin
ClearDebug;
SetupSRL;
Smart_Server := 111;
Smart_Signed := False;
Smart_Members := True;
LoadCSBitmaps;
DeclarePlayers;
if MySRLID <> '' then
begin
SRLID := MySRLID;
SRLPassword := MySRLPassword;
end;
for I := 0 to 19 do
ReportVars[I] := 0;
ReportVars[12] := 1;
ScriptID := '299';
GraphicsSet := True;
LoginPlayer;
FTWait(4);
SetRun(True);
MouseSpeed := 30;
Start := GetSystemTime;
SymbolAccuracy := 0.6;
HPLevel := GetSkillInfo('hitpoints', False);
ThievingLevel := GetSkillLevel('thieving');
BankColor := GetSymbolColor(DumX, DumY, 'bank')
if FawkiDebug then writeln('BankColor := ' +IntToStr(BankColor));
if (BankColor = 0) then
begin
writeln('ERROR: Couldnt find BankColor. Exiting...');
Terminatescript;
end;
SetFood(TheFood);
WTDown;
end;
//----------------------------------------------------------------------------//
begin
// SmartsetupEx(51, true, true, false);
// SetTargetDC(SmartGetDC);
Setup;
FixChat;
HPAmount := GetSkillInfo('hitpoints', True);
if not FindBenedict then Quit('Couldnt find Benedict');
if not Bank then Quit('No food at Bank');
repeat
ClickNorth(False);
ToSafe;
Start := GetSystemTime;
repeat
if not LoggedIn then Exit;
if Stethoscope then if HaveStethos then ClickStethos;
if ClickSafe then if WaitSafe then Start := GetSystemTime;
if not CheckAndRestoreHealth then break;
if Stethoscope then if HaveStethos then ClickStethos;
if ClickSafeTPA then if WaitSafe then Start := GetSystemTime;
if InvFull then Break;
Emergency := GetSystemTime;
if Emergency - Start > 50000 then // if for 50 secs no safes then break
begin
Start := GetSystemTime;
Break;
end;
if (GetTimeRunning mod 60000) < 1500 then
begin
if InvFull or (not HaveFood(Dumx, Dumy)) then break;
ProgressReport;
CountLoot;
IdleTime(2500, 2500, 0.6);
end;
FTWait(1);
until false; // DID I WRITE THIS? :)
if not ToBank then Quit('Couldnt Find Bank');
if not FindBenedict then Quit('Couldnt find Benedict');
if not Bank then Quit('No food at Bank');
MakeCompass('N');
Start := GetSystemTime;
ProgressReport;
until false
end.