R0b0t1
2008-02-17 02:29:17
For Fawki's safe cracker. The newest rev. doesn't have CountItemBMPTol… Thats why I need rev six.
2008-02-17 02:29:17
2008-02-17 02:40:38
{.Script Info:
# ScriptName = Safe Cracker
# Author = WT-Fakawi
# Description = Cracks Safe. Banks gems.
# Version = 0.22
# Date = Sun. Nov 4, 2007.
# Comments = SRL 4 Rev #6.
/Script Info}
//----------------------------------------------------------------------------//
// *
// * NAME : Safe Cracker
// * WRITER : WT-Fakawi
// * CATEGORY : Collecting/Banking
// * DESCRIPTION : Cracks safes and banks Gems.
// * 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 Rev #6
//----------------------------------------------------------------------------//
// 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. HAVE FOOD (LOBSTER/SALMON) VISIBLE IN UPPER BANK PAGE
//----------------------------------------------------------------------------//
program SafeCracker;
{.include SRL/SRL.scar}
// SAMPLE THE BROWN OUTLINE OF THE SAFE
Const SafeColor = 3104641;
// SAMPLE THE BROWN OUTLINE OF THE SAFE
Const TheFood = 'lobster'; // two choices for now: 'lobster' and 'salmon'
Const VersionNumber = '0.21';
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
var
Sapphires, Emeralds, Rubies, Diamonds,
Fails, Cracks, NewFails, OldFails, NewCracks, OldCracks, Ate, OAte, NAte,
MMCrackSafe, MMCrackSafe2, MMCrackSafe3, LSx, LSy, Start, Emergency, Food,
Dumx, Dumy, FoodHeals, FoodLeft, Damage :Integer;
//----------------------------------------------------------------------------//
Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='R0b0t1';
Players[0].Pass :='';
Players[0].Nick :='0b0';
Players[0].Active := True;
end;
//----------------------------------------------------------------------------//
Procedure Down;
Begin
KeyDown(VK_DOWN);
Wait(2500 + Random(1000));
KeyUp(VK_DOWN);
End;
//----------------------------------------------------------------------------//
Procedure Up;
Begin
KeyDown(VK_UP);
Wait(2500 + Random(1000));
KeyUp(VK_UP);
End;
//----------------------------------------------------------------------------//
Function ClickColorSpiral(CenterX, CenterY, Color, Xoff, Yoff, Pause:Integer):Boolean;
begin
if FindColorSpiral(CenterX, CenterY, Color, MMX1, MMY1, MMX2, MMY2) Then
begin
MouseFindFlag(CenterX + Xoff, CenterY + Yoff, 1, -1);
Wait(Pause);
FFlag(0);
FindNormalRandoms;
Result:=True;
end;
end;
//----------------------------------------------------------------------------//
procedure PlayerStats;
var Active: string;
var i: Integer;
begin
writeln('**********************************************');
writeln('Name : '+ Players[CurrentPlayer].Name);
writeln('Number : '+ inttostr(CurrentPlayer));
writeln('Worked for : '+ inttostr(Players[CurrentPlayer].Worked)+' minutes.');
if Players[CurrentPlayer].Active=True then Active:='True' else Active:='False';
writeln('Active : '+ Active);
writeln('**********************************************');
for i := 0 to HowManyPlayers-1 do
begin
if Players[i].Active=True then Active:='T' else Active:='F';
writeln( (inttostr(i))+' : '+Players[i].name + ' = '+Active
+'. '
+'TH '+inttostr(Players[i].level[11])+'. '
+'W : '+IntToStr(Players[i].Worked)+' min. ');
end;
writeln('**********************************************');
end;
//----------------------------------------------------------------------------//
procedure ProgressReport;
begin
begin
WriteLn(' ');
WriteLn('<============== - Progress Report ===============>');
writeln('Worked for '+ TimeRunning);
writeln('Banked '+ IntToStr(Banks)+ ' Times');
writeln('Cracked '+ IntToStr(Cracks)+ ' Safes');
writeln('Failed '+ IntToStr(Fails)+ ' Safes');
writeln('Ate '+ IntToStr(Ate)+ ' Food');
writeln('Banked '+ IntToStr(Sapphires)+ ' Sapphires');
writeln('Banked '+ IntToStr(Emeralds)+ ' Emeralds');
writeln('Banked '+ IntToStr(Rubies)+ ' Rubies');
writeln('Banked '+ IntToStr(Diamonds)+ ' Diamonds');
PlayerStats;
Writeln(' ');
end;
end;
procedure LoadCSBitmaps;
begin
MMCrackSafe := BitmapFromString(4, 6, 'beNpz5YxxRSAGIsCX50/' +
'gCKEXAIWlEE0=');
MMCrackSafe2 := BitmapFromString(1, 21, 'beNpjYICAzlQBUhFIG' +
'wACahDf');
MMCrackSafe3 := BitmapFromString(1, 28, 'beNpLFehMFXj69h0DD' +
'AC5ZCC4dqBRnQAywhlZ');
end;
//----------------------------------------------------------------------------//
procedure SetFood(WhatFood:String);
begin
case WhatFood of
'lobster':
Begin
Food := BitmapFromString(11, 14, 'z78DA33302016B86100038' +
'A017E7388B105971AE25DE8860350E20B4A4C202F6C87BA09D48A' +
'477A9A406A9A21553D000D2CBE45');
FoodHeals := 12;
End;
'salmon':
Begin
Food := BitmapFromString2(False, 'a0AA9478DACDD04B0A80300' +
'C04D02B4D3F69B3556BEF7F2433D92808A29482593C0A69261000' +
'68D1802E467625EF7457DA8B5902FF1464332A15D9CEAE078826B' +
'E6B306B64B7A646A553CF4C2A66587D00E85E9850D7E4195BEE99' +
'B3B7FCFF56FDB1C66F3532F5BEBEE61FA70');
FoodHeals := 9;
End
end
end;
//----------------------------------------------------------------------------//
Function HaveFood(var Lx, Ly:Integer): Boolean;
var Dx, Dy:integer;
begin
GameTab(4);
FoodLeft := CountItemsBmp('inv', food, 25);
if FindBitmapMaskTolerance(Food,Dx, Dy, MIX1, MIY1, MIX2, MIY2, 30, 30) then
begin
Lx := Dx;
Ly := Dy;
Result := True;
end
else Result := False;
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);
writeln(' ');
writeln(IntToStr(Sb) + ' Sapphires' );
writeln(IntToStr(Eb) + ' Emeralds' );
writeln(IntToStr(Rb) + ' Rubies' );
writeln(IntToStr(Db) + ' Diamonds' );
end;
//----------------------------------------------------------------------------//
function FlagFTWait:Boolean;
var FlagMark: Integer;
begin
MarkTime(FlagMark);
if not FlagPresent then
begin
Result := False;
Exit;
end
else
begin
repeat
FTWait(1);
if not(Loggedin) then break;
until ( (not FlagPresent) or (TimeFromMark(FlagMark) > 6000) ); // waits until flag is gone or 6 seconds.
Result := True;
Wait(250);
end;
end;
//----------------------------------------------------------------------------//
Function ToSafe:Boolean;
var
Gx, Gy:Integer;
begin
MakeCompass('N');
Gx := 711;
Gy := 100;
if FindBitmapSpiralTolerance(MMCrackSafe3, Gx, Gy, MMx1, MMy1, MMX2, MMY2, 20) then
begin
Writeln('bitmap found');
MFF(Gx, Gy , 0, 10);
FFlag(0);
FTWait(4);
Result := True;
end
else
begin
MFF(693 + Random(4), 90 + Random(4), 0, 1);
FFlag(0);
FTWait(4);
Result := True;
end;
end;
//----------------------------------------------------------------------------//
Function ClickSafe:Boolean;
var
x, y :integer;
begin
x := LSx;
y := LSy;
if FindColorSpiralTolerance(x, y, SafeColor, MSx1, MSy1, MSx2, MSy2, 2) then
begin
MMouse(x, y, 5, 10);
GetMousePos(x, y);
Wait(100);
if isUpText('safe') then
begin
LSx := x;
LSy := y;
Mouse(x, y, 0, 0, True);
Result := True;
end
else Result := False;
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);
FindTalk;
Result := True;
end
else
Result := False;
end;
end;
//----------------------------------------------------------------------------//
Function FindBenedict:Boolean;
var Dmx, Dmy, Ax, Ay, x, STime, ETime,TTime: integer;
Benedict :array[1..4] of integer;
Rotated:Boolean;
begin
STime := GetSystemTime;
Benedict[1] := 5535101;
Benedict[2] := 5666942;
Benedict[3] := 5337722;
Benedict[4] := 1123111;
repeat
for x := 1 to 4 do
begin
if not LoggedIn then Exit;
Ax := MSCx - 20 + Random(20);
Ay := MScy - 20 + Random(20);
ETime := GetSystemTime;
Wait(100);
if FindColorSpiralTolerance(Ax, Ay, Benedict[x], MSX1, MSY1, MSX2, MSY2, 5) then
begin
MMouse(Ax, Ay, 4, 4);
GetMousePos(Ax, Ay);
Wait(100);
if FindColorTolerance(Dmx, Dmy, 318168, 42, 8, 120, 21, 50) then // Yellow
begin
if IsUpText('mer') then
begin
Mouse(Ax, Ay, 0, 0, False);
if Chooseoption('Bank') then
begin
FFlag(0);
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
begin
if not Rotated then
begin
ClickBankSymbol;
MakeCompass('W');
Rotated := True;
end;
end;
x := 1;
until(ETime-STime > 20000);
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);
if ClickBankSymbol then
begin
Result := True;
Exit;
end
else
Result := False;
end
end;
//----------------------------------------------------------------------------//
Function WaitSafe:Boolean;
var
OBCM, NBCM: String;
TimeOut:Integer;
begin
FFlag(0);
FTWait(4);
TimeOut := GetSystemTime;
OBCM:= GetBlackChatMessage;
if Pos('start', OBCM) <> 0 then
begin
repeat
NBCM := GetBlackChatMessage;
Wait(100);
if OBCM <> NBCM then
begin
if Pos('loot', NBCM) <> 0 then
begin
Result:= True;
Inc(Cracks);
FTWait(2 + Random(4));
Exit;
end;
if Pos('slip', NBCM) <> 0 then
begin
Result:= False;
Inc(Fails);
{ if FindColorTolerance(x, y, 1386542, 215, 183, 268, 214, 2) then
begin
MMouse(x, y, 0, 0);
if IsUpText('2 more') then
begin
Mouse(x, y, 0, 0, False);
if ChooseOption('Search') then
begin
DT := GetsystemTime;
repeat
FtWait(1);
DisArm := GetBlackChatMessage;
if GetSystemTime - DT > 5000 then break;
until (pos('disarm', DisArm ) <> 0);
end;
end
end; }
Exit;
end;
end;
until GetSystemTime - TimeOut > 12000;
end;
end;
//----------------------------------------------------------------------------//
Function Bank:Boolean;
var Dx, Dy:integer;
begin
Fixbank;
NewCracks := Cracks;
Reportvars[0] := NewCracks - OldCracks;
OldCracks := Cracks;
NewFails := Fails;
Reportvars[1] := NewFails - OldFails;
OldFails := Fails;
NAte := Ate;
Reportvars[2] := NAte - OAte;
OAte := Ate;
Reportvars[3] := CountItemCol(9573906);
Reportvars[4] := CountItemCol(1477648);
Reportvars[5] := CountItemCol(858746);
Reportvars[6] := CountItemCol(11776948);
Sapphires := Sapphires + Reportvars[3];
Emeralds := Emeralds + Reportvars[4];
Rubies := Rubies + Reportvars[5];
Diamonds := Diamonds + Reportvars[6];
SRLRandomsReport;
DepositAll;
ProgressReport;
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
writeln('cant find food');
Result := False;
end;
end;
//----------------------------------------------------------------------------//
procedure RunAwayEx;
begin
Runto('N', False);
FTWait(8);
Logout;
Terminatescript;
end;
//----------------------------------------------------------------------------//
Function CheckAndRestoreHealth: Boolean;
var Lx, Ly, HPAmount, HPLevel:Integer;
begin
GameTab(2);
HPAmount := GetSkillInfo('hitpoints', true);
HPLevel := GetSkillInfo('hitpoints', False);
Damage := HPLevel - HPAmount;
Status('Damage = ' + IntToStr(Damage));
Result := True;
if Damage >= FoodHeals then
begin
if HaveFood(Lx,Ly) then
begin
Mouse(Lx , Ly , 4, 4, True);
Inc(Ate);
FTWait(4);
FindInventoryRandoms;
CountLoot;
CheckAndRestoreHealth;
end
else
Result := False;
end;
if Damage > 30 then RunawayEx;
end;
//----------------------------------------------------------------------------//
procedure Setup;
var
i:Integer;
begin
ClearDebug;
SetupSRL;
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';
LoginPlayer;
SetChat('On',1);
SetRun(True);
MouseSpeed := 40;
Start := GetSystemTime;
SymbolAccuracy := 0.6;
GameTab(4);
BankColor := GetSymbolColor(DumX, DumY, 'bank')
Writeln('BankColor := ' +IntToStr(BankColor));
if (BankColor = 0) then
begin
Writeln('ERROR: Couldnt find colors. Exiting...');
Terminatescript;
end;
SetFood(TheFood);
Down;
end;
//----------------------------------------------------------------------------//
begin
Setup;
FixChat;
if not FindBenedict then Quit('Couldnt find Benedict');
if not Bank then Quit('No food at Bank');
repeat
GetAllLevels;
ToSafe;
repeat
if not LoggedIn then Exit;
if ClickSafe then if WaitSafe then
Start := GetSystemTime;
Emergency := GetSystemTime;
if Emergency - Start > 50000 then // if for 50 secs no pickpocket then break
Break;
FindNonInventoryRandoms;
if not CheckAndRestoreHealth then break;
if (GetTimeRunning mod 30000) < 1500 then
begin
FindInventoryRandoms;
if InvFull or (not HaveFood(Dumx, Dumy)) then break;
ProgressReport;
CountLoot;
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;
until false
end.2008-02-17 02:41:00
2008-02-17 12:50:43
2008-02-17 13:02:19
2008-02-17 13:06:00
2008-02-17 13:46:42
From: R0b0t1
OHOOHOHOHOHO!
CountItemBMPTol -> CountItemBMP….
2008-02-17 18:43:02