R0b0t1
2008-02-21 23:17:15
But can you tell me what you changed?
{.Script Info:
# ScriptName = Master Farmer Thiever
# Author = WT-Fakawi
# Description = Thieves Master Farmer. Autoeats and banks seeds.
# Version = 0.22
# Date = Fri. May 11, 2007.
# Comments = SRL 4 upwards compatible.
/Script Info}
//----------------------------------------------------------------------------//
// *
// * NAME : Master Farmer Thiever
// * WRITER : WT-Fakawi
// * CATEGORY : Collecting/Banking
// * DESCRIPTION : Thieves Master Farmer autoeats and banks seeds
// * USAGE : Start @ Draynor Bank Face North
// * AUTOCOLOR : Yes.
// * NOTES : SRL 4
//----------------------------------------------------------------------------//
// 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 at Draynor Bank.
// 5. HAVE FOOD (LOBSTER/SALMON) VISIBLE IN UPPER BANK AREA
//----------------------------------------------------------------------------//
program MasterFarmerThiever;
{.include SRL/SRL.scar}
Const TheFood = 'salmon'; // two choices for now: 'lobster' and 'salmon'
Const VersionNumber = '0.23';
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
MFx, MFy, LadderColor, Start, Emergency, PickPockets, Food, Dumx, Dumy,
Miss, FoodHeals, FoodLeft, Damage, DraynorSquareDTM:Integer;
MFC: array[1..4] of integer;
OT, NT: String;
type
Seed = record
Name: String; // item name
Num: Integer; // how many collected
End;
var
Seeds: array[1..100] of Seed;
//----------------------------------------------------------------------------//
Procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='R0b0t1';
Players[0].Pass :='';
Players[0].Nick :='0b0';
Players[0].Active := True;
End;
//----------------------------------------------------------------------------//
procedure LoadBitMaps;
var
i:Integer;
begin
MFC[1] := 5339250; // Master Farmer
MFC[2] := 5668985;
MFC[3] := 5339250; // Master Farmer
MFC[4] := 5668985;
for i:= 1 to 100 do
Seeds[i].Name := ' ' ;
End;
//----------------------------------------------------------------------------//
Function MFFaxc(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not (FlagPresent)) then
begin
xx := ax;
yy := ay;
MarkTime(BreakOutTime);
for i := 0 to 3 do
begin
xx := xx + xmod + Random(3);
yy := yy + ymod+ Random(3);
Mouse(xx, yy, 2, 2, True);
Wait(200);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
End;
until TimeFromMark(TT) > 1500;
End;
Result := False;
End;
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('Picked '+ IntToStr(PickPockets)+ ' Pockets');
writeln('Banked '+ IntToStr(Banks)+ ' Times');
PlayerStats;
SRLRandomsReport;
Writeln(' ');
End;
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 := CountItemBmpTol(Food,20);
if FindBitmapMaskTolerance(Food,Dx, Dy, MIX1, MIY1, MIX2, MIY2, 20, 20) then
begin
Lx := Dx;
Ly := Dy;
Result := True;
End;
End;
//----------------------------------------------------------------------------//
Procedure ParseFood;
Var
name: String;
i, a, num: integer;
Found: Boolean;
Begin
OT := GetBlackChatMessage;
if OT <> NT then
NT := GetBlackChatMessage
else
Exit;
Name := NT;
a := Pos('steal', Name)
If a <> 0 Then
Begin
Num := StrToInt(StrGet(Name, a + 6));
Delete(Name, 1, a + 7);
Delete(Name, Pos(' ', Name), Length(Name));
Found := False;
for i := 1 to 100 do
begin
if Seeds[i].Name = Name then
begin
Seeds[i].Num := Seeds[i].Num + Num;
Found := True;
break;
End;
End;
if not Found then
begin
for i := 1 to 100 do
begin
if Seeds[i].Name = ' ' then
begin
Seeds[i].Name := Name;
Seeds[i].Num := num;
Found := True;
break;
End;
End;
End;
ClearDebug;
ProgressReport;
for i := 1 to 100 do
begin
if Seeds[i].Name = ' ' then exit;
writeln(IntToStr(Seeds[i].Num) + ' ' + Seeds[i].Name );
End;
End;
End;
//----------------------------------------------------------------------------//
function FindInventRandoms: Boolean;
begin
if Not LoggedIn then Exit;
GameTab(4);
if FindLamp(LampSkill) then
Result := True;
if FindBox then SolveBox;
ParseFood;
End;
//----------------------------------------------------------------------------//
function FindNonInventRandoms: Boolean;
var
i: Integer;
text:string;
begin
for i := 0 to 10 do
begin
case I of
0: if SolveChatRandom then
Result := True;
1: if ClickContinue(True, True) then
Result := True;
2: Respond;
3: if FindTalk then
Result := True;
4: if FindDead then
Result := True;
5: if FindMod then
Result := True;
6: if FindMime then
Result := True;
7: if FindMaze then
Result := True;
8: if FindQuiz then
Result := True;
9:
begin
if NoGameTab then
begin
Result := True;
Players[CurrentPlayer].Rand := 'No GameTab';
Wait(3000);
GetLastChatText(Text);
writeln(Text);
WriteFileString(TheFile, TheTime + ' NO GAMETAB MESSAGE '+': ' + Text + Chr(13));
SaveToChatLog;
Logout;
Exit;
End;
End;
10: if RC then
Result := True;
End;
if Result then
Break;
Wait(1);
End;
ParseFood;
End;
//----------------------------------------------------------------------------//
function FindDraynorRoadColor: Boolean;
var
c, TX, TY, DraynorRoad: Integer;
begin
DraynorRoad := BitmapFromString(8, 8, 'z78DA333333753575351' +
'B2507880400265E5801');
while (c < 65) do
begin
c := c + 5;
if FindBitmapToleranceIn(DraynorRoad, TX, TY, 578, 46, 614, 70, c) then
begin
RoadColor := GetColor(TX, TY);
WriteLn('RoadColor := ' + IntToStr(RoadColor));
Result := True;
Exit;
End;
End;
Result := False;
End;
//----------------------------------------------------------------------------//
function FindDraynorLadderColor: Boolean;
var
c, TX, TY, DraynorLadder: Integer;
begin
DraynorLadder := BitmapFromString(6, 3, 'z78DA33B53032363031258634' +
'363432B0C442126D0200A38E15C5');
while (c < 85) do
begin
c := c + 5;
if FindBitmapToleranceIn(DraynorLadder, TX, TY, 636, 39, 648, 49, c) then
begin
LadderColor := GetColor(TX, TY);
Result := True;
WriteLn('LadderColor := ' + IntToStr(LadderColor));
Exit;
End;
End;
Result := False;
End;
//----------------------------------------------------------------------------//
procedure SetDraynorDTM;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 737;
dtmMainPoint.y := 307;
dtmMainPoint.AreaSize := 0;
dtmMainPoint.AreaShape := 1;
dtmMainPoint.Color := 6316392;
dtmMainPoint.Tolerance := 255;
dtmSubPoints[0].x := 738;
dtmSubPoints[0].y := 287;
dtmSubPoints[0].AreaSize := 2;
dtmSubPoints[0].AreaShape := 1;
dtmSubPoints[0].Color := RoadColor;
dtmSubPoints[0].Tolerance := 0;
dtmSubPoints[1].x := 717;
dtmSubPoints[1].y := 307;
dtmSubPoints[1].AreaSize := 2;
dtmSubPoints[1].AreaShape := 1;
dtmSubPoints[1].Color := RoadColor;
dtmSubPoints[1].Tolerance := 0;
dtmSubPoints[2].x := 720;
dtmSubPoints[2].y := 318;
dtmSubPoints[2].AreaSize := 2;
dtmSubPoints[2].AreaShape := 1;
dtmSubPoints[2].Color := RoadColor;
dtmSubPoints[2].Tolerance := 0;
dtmSubPoints[3].x := 761;
dtmSubPoints[3].y := 315;
dtmSubPoints[3].AreaSize := 2;
dtmSubPoints[3].AreaShape := 1;
dtmSubPoints[3].Color := RoadColor;
dtmSubPoints[3].Tolerance := 0;
dtmSubPoints[4].x := 763;
dtmSubPoints[4].y := 293;
dtmSubPoints[4].AreaSize := 2;
dtmSubPoints[4].AreaShape := 1;
dtmSubPoints[4].Color := RoadColor;
dtmSubPoints[4].Tolerance := 0;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
DraynorSquareDTM := AddDTM(TempTDTM);
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 FindDraynorBank: Boolean;
var
CALX, CALy, DB:Integer;
WhichAngle: ExtEnd;ed;
begin
DB := DTMFromString('78DA636C616260886440018991510CFF81342' +
'310FF0702C64AA09A60881C1354CD9F3F101623940F56134D849A' +
'04026A0A08AB010075F4123A');
if FindDtmRotated(DB, CALx, CALy, MMX1, MMY1, MMX2, MMY2, -pi/4, pi/4, 0.05,
WhichAngle) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
MFFaxc(CALx, CALy, 1, 1);
FlagFTWait;
FTWait(4);
Result := True;
FreeDTM(DB);
Exit;
End;
End;
FreeDTM(DB);
End;
//----------------------------------------------------------------------------//
Function Bank:Boolean;
var Dx, Dy:integer;
begin
if FindDraynorBank then
begin
if OpenBankFast('db') then
// if OpenBankQuiet('db') then
begin
Fixbank;
DepositAll;
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;
CloseBank;
End;
else
begin
Logout;
Writeln('No food at Bank');
Terminatescript;
End;
End;
else Result := False;
End;
else Result := False;
End;
//----------------------------------------------------------------------------//
procedure RunAway;
begin
Runto('N',True);
Logout;
Terminatescript;
End;
Function ToDraynorCentre:Boolean;
var CALX, CALy:Integer;
WhichAngle: ExtEnd;ed;
begin
If FindColor(CALx,CALy,LadderColor,MMX1, MMY1, MMX2, MMY2) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
Result := True;
MFFaxc(CALx - 30,CALy + 20,1,0);
FFlag(0);
FindTalk;
Exit;
End;
End;
if FindDtmRotated(DraynorSquareDTM, CALx, CALy, MMX1, MMY1, MMX2, MMY2, -pi/4, pi/4, 0.05,
WhichAngle) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
Result := True;
MFFaxc(CALx, CALy, 1, 1);
FlagFTWait;
Exit;
End;
End; else Writeln('Not Found');
If FindSymbol(CALx,CALy,'quest') then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
Result := True;
MFFaxc(CALx+20,CALy-30,1,0);
FFlag(0);
FindTalk;
Exit;
End;
End;
End;
//----------------------------------------------------------------------------//
Function CheckAndRestoreHealth: Boolean;
var Lx, Ly, HPAmount, HPLevel:Integer;
begin
GameTab(2);
HPAmount := GetSkillAmount('hitpoints');
HPLevel := GetSkillLevel('hitpoints');
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);
FTWait(4);
FindInventRandoms;
CheckAndRestoreHealth;
End;
else
Result := False;
End;
if Damage >30 then Runaway;
End;
//----------------------------------------------------------------------------//
Function NotInRoad:Boolean;
var
Dx, Dy:Integer;
begin
Result := not FindColor(Dx, Dy, RoadColor,MMCx - 2, MMCy -2, MMCx + 2, MMCy + 2);
End;
//----------------------------------------------------------------------------//
Function NearPigs:Boolean;
var
Dx, Dy:Integer;
begin
Result := FindColoredAreaTolerance(Dx, Dy, 11056084, MSCx - 40, MSCy -40, MSCx + 40, MSCy + 40, 9, 10);
End;
//----------------------------------------------------------------------------//
function Thieve: Boolean;
var
x, y, cx, cy, dx, dy, x1, y1, x2, y2, LeftCorner, RightCorner: Integer;
RawMenuText: string;
begin
Dx := 668;
Dy := 120
LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
'411A600064715CEA914500CACE13F0');
RightCorner := BitmapFromString(4, 4, 'z78DA33753135313137' +
'C5200D30002E35F8C501C9C013F0');
if (FindBitmap(LeftCorner, x1, y1)) and (FindBitmap(RightCorner, x2, y2)) then
begin
if (FindText(cx, cy, 'Pick', upchars, x1, y1, x2, 502)) then
begin
Result := True;
RawMenuText := GetTextAtEx(cx, cy, 100, upchars, True, True, 0, 0, -1, 25,
False, tr_NormalChars);
MouseBox(x1 + 5, cy + 4, x2, cy + 10, True);
if pos('artin',RawMenuText) <> 0 then
begin
if not ToDraynorCentre then begin logout; terminatescript; End;
{ if ((FoodLeft = 0) and (Damage > 12)) then
begin
FindColorSpiral(Dx, Dy, RoadColor, MMX1, MMY1, MMX2, MMY2);
Mouse(Dx, Dy, 2, 2, True);
Wait((2000) + Random(500));
if (FindColor(Dx, Dy, 255, MMX1, MMY1, MMX2, MMY2)) then
FFlag(10) // all cool, moving...
else
if NotInRoad and NearPigs then
begin
Logout; // stuck in barn.
Terminatescript;
End;
FreeBitmap(LeftCorner);
FreeBitmap(RightCorner);
Exit;
End; }
End;
End;
else if (FindText(x, y, 'Cancel', upchars, x1, y1, x2, 502)) then
begin
GetMousePos(x,y);
MMouse(x,y,(MSx2 - Random(MSx2)), (MSy2 - Random(MSy2)));
Wait(20);
End;
End;
FreeBitmap(LeftCorner);
FreeBitmap(RightCorner);
End;
//----------------------------------------------------------------------------//
Function PickPocketMasterFarmer: Boolean;
var
CBx, CBy, i, Dumx, Dumy: Integer;
begin
for i := 1 to 4 do
begin
CBx := MFx;
CBy := MFy;
if FindColorSpiralTolerance(CBx, CBy, MFC[i], MSx1, MSy1+30, MSx2, MSy2, 1) then
begin
MMouse(CBx, CBy, 2, 8);
GetMousePos(CBx, CBy);
if FindColorTolerance(Dumx, Dumy, 318168, 42, 8, 120, 21, 50) then // Yellow
begin
if IsTextInAreaEx(7, 7, 160, 20, Dumx, Dumy, 'ar', 100, upchars, True,
True, 0, 2, -1) then
begin
Mouse(CBx, CBy, 0, 0, False);
FlagFTWait;
if Thieve then
begin
Result := True;
MFx := CBx;
MFy := CBy;
Inc(PickPockets);
Miss := 0;
Exit;
End;
End;
else
begin
MFx := Random(MSx2);
MFy := Random(MSy2);
End;
End;
End;
End;
if not Result then Inc(Miss);
End;
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
Procedure ToDraynorBank;
var CALX, CALy:Integer;
begin
FTWait(16);
RadialRoadWalk(RoadColor, 180, 150, 30, 1,1);
FTWait(4);
if NotInRoad and NearPigs then
begin
Logout; // stuck in barn.
Terminatescript;
End;
If FindColor(CALx,CALy,LadderColor,MMX1, MMY1, MMX2, MMY2) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
MFFaxc(CALx + 4,CALy + 40,1,1);
FFlag(0);
FindTalk;
End;
End;
If FindColor(CALx,CALy,BankColor,MMX1, MMY1, MMX2, MMY2) then
begin
if rs_OnMiniMap(CALx, CALy) then
begin
MFFaxc(CALx,CALy,1,1);
FFlag(0);
FindTalk;
End;
End;
End;
//----------------------------------------------------------------------------//
procedure Setup;
var
i:Integer;
begin
Quizs := 0;
ClearDebug;
SetupSRL;
LoadBitMaps;
DeclarePlayers;
if MySRLID <> '' then
begin
SRLID := MySRLID;
SRLPassword := MySRLPassword;
End;
for I := 0 to 19 do
ReportVars[I] := 0;
ReportVars[12] := 1;
ScriptID := '264';
LoginPlayer;
SetChat('On',1);
SetRun(True);
MouseSpeed := 40;
Start := GetSystemTime;
SymbolAccuracy :=0.6;
GameTab(4);
SetDraynorDTM;
BankColor := GetSymbolColor(DumX, DumY, 'bank')
Writeln('BankColor := ' +IntToStr(BankColor));
if (not FindDraynorRoadColor) or (not FindDraynorLadderColor) or (BankColor = 0) then
begin
Writeln('ERROR: Couldnt find colors. Exiting...');
Terminatescript;
End;
SetFood(TheFood);
End;
//----------------------------------------------------------------------------//
begin
Setup;
Bank;
repeat
GetAllLevels;
ToDraynorCentre;
repeat
if Not LoggedIn then Exit;
if PickPocketMasterFarmer then
Start := GetSystemTime;
ParseFood;
Emergency := GetSystemTime;
if Emergency - Start > 50000 then // if for 50 secs no pickpocket then logout
Begin
if not ToDraynorCentre then
begin
LogOut;
TerminateScript;
End;
End;
FindNonInventRandoms;
if not CheckAndRestoreHealth then break;
if (GetTimeRunning mod 30000) < 1500 then
begin
FindInventRandoms;
if InvFull or (not HaveFood(Dumx, Dumy)) or (Miss > 100) then break;
ProgressReport;
End;
ParseFood;
FTWait(1);
ParseFood;
until false; // DID I WRITE THIS? :)
ToDraynorBank;
Bank;
MakeCompass('n');
Start := GetSystemTime;
until false
End;.