jimmy_mac
2009-12-10 08:05:59
2 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
I know a bit of php, actionscript, html thats about it.
Are you a member of any other communities?
No
Tell us about yourself…
From: jimmy_mac
My names jimmy,
i like goin out n socialising and in my spare time play on the computer or xbox. fairly laid back n chilled. Loving scriptin. :)
Please show us one (or multiple) of your scripts.
{==============================================================================]
[ DRAYNOR FISH 'N' BANK v1.4 ]
[==============================================================================]
[ ]
[ Written By: jimmy_mac ]
[ ]
[==============================================================================]
[ Instructions. ]
[==============================================================================]
[ ]
[ 1. Fill in Declare Players (lines 22 - 82). ]
[ 2. Have either 'net' or 'rod and bait' in inventory. ]
[ 3. Start in Draynor Bank or at Fishing Spot. ]
[ ]
[==============================================================================}
program DraynorFishNBank;
{.include SRL/SRL/Misc/SMART.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/fishing.scar}
procedure DeclarePlayers;
begin
HowManyPlayers := 1; //Total Number of Players.
CurrentPlayer := 0; //Starting Player.
NumberOfPlayers(HowManyPlayers);
Players[0].Name :=''; //Username.
Players[0].Pass :=''; //Password.
Players[0].Nick :=''; //Nickname. (4 Letters of your username)
Players[0].Active := True; //Is the player active?
Players[0].Pin := ''; //Leave blank if you dont have one.
Players[0].Booleans[0] := True; //Clear the Debug?
Players[0].Integers[0] := 10; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[0].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[0].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
{
Players[1].Name :=''; //Username.
Players[1].Pass :=''; //Password.
Players[1].Nick :=''; //Nickname. (4 Letters of your username)
Players[1].Active := True; //Is the player active?
Players[1].Pin := ''; //Leave blank if you dont have one.
Players[1].Booleans[0] := True; //Clear the Debug?
Players[1].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[1].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[1].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
Players[2].Name :=''; //Username.
Players[2].Pass :=''; //Password.
Players[2].Nick :=''; //Nickname. (4 Letters of your username)
Players[2].Active := True; //Is the player active?
Players[2].Pin := ''; //Leave blank if you dont have one.
Players[2].Booleans[0] := True; //Clear the Debug?
Players[2].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[2].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[2].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
Players[0].Name :=''; //Username.
Players[0].Pass :=''; //Password.
Players[3].Nick :=''; //Nickname. (4 Letters of your username)
Players[3].Active := True; //Is the player active?
Players[3].Pin := ''; //Leave blank if you dont have one.
Players[3].Booleans[0] := True; //Clear the Debug?
Players[3].Integers[0] := 5; //Amount of Levels Gained, Change to zero if you want
//to stop once its banked a certain amount of 'loads'.
Players[3].Integers[1] := 0; //Amount of Loads you want Banked, Change to zero if
//you want to stop once gained a certain amount of 'levels'.
Players[3].Integers[2] := 13; //Maximum time (in seconds) before catching a fish.
}
end;
{******************************************************************************}
{* YOU DON'T NEED TO EDIT BELOW HERE *}
{******************************************************************************}
const WriteToDebug = False; //See debug info. (For Dev)
var
Net, Rod, Shrimp, Anchovie, Sardine, Herring, Bait: Integer;
FindFishAttempts, FishingMax, PlainWater, myFile : Integer;
StillFishing : Boolean;
Method, MethodChoose, Completed: String;
CatchColor: Array of Integer;
function CompassInt:Integer;
begin
result := round(rs_GetCompassAngleDegrees);
end;
procedure Debug(text:String);
begin
if WriteToDebug then writeln(text);
end;
procedure MakePlayerInactive;
begin
if PlayersActive <= 1 then
begin
Writeln('Last player left, logging out.');
Players[CurrentPlayer].Active := False;
Logout;
end else NextPlayer(False);
end;
function RadialWalkTolWait(TheColor, Tol: Integer; StartRadial, EndRadial: Integer; Radius: Integer; Xmod, Ymod: Integer; waitTime:integer; flagDist:Integer): Boolean;
var
tpa : TPointArray;
i : Integer;
begin
Result := False;
StartRadial := StartRadial + (360 - CompassInt);
EndRadial := EndRadial + (360 - CompassInt);
if RadialWalkEx(tpa, MMCX, MMCY, TheColor, Tol, StartRadial, EndRadial, Radius) then
for i := 0 to High(tpa) do
if MFNF(tpa[i].x, tpa[i].y, Xmod, Ymod) then
begin
wait(waitTime*1000);
FFlag(flagDist);
Result := True;
Break;
end;
end;
Procedure LoadDTMs;
begin
Shrimp := DTMFromString('78DA63CC67626078CD800236D6A7307001694' +
'620FE0F048CD940357719D00013986484F218AB80FC8704D46463' +
'DA85A12616C87F4484391F09A84904F2DFE0570300041E0EFE');
Anchovie := DTMFromString('78DA63CC67626078CD8002CACB6B18B880342' +
'310FF0702C66CA09ABB0C6880094C3242798C5540FE43026AB231' +
'EDC250130BE43F22C29C8F04D42402F96FF0AB0100DDD70ED4');
Sardine := DTMFromString('78DA637462606058C2800212D62432B003694' +
'620FE0F048CEE40C62C0634C0042619A13C464F20318F801A3F20' +
'319F801A3B20B182801A1B20B194801A6720B18C801A90DF97E35' +
'70300FC570CC3');
Herring := DTMFromString('78DA63B4676260E0616440061B56AE60E007D' +
'220D1FF40C0E80A54C38AAA868181094CC244193D807C4E026A7C' +
'807C36026ACC8830C704C81720A0C619C8E727A0C616C817C2AF0' +
'600B6A6089F');
Net := DTMFromString('78DA639CCEC4C0F084010518A9CB30B003694' +
'620FE0F048CF3816A6E33A0012630C908E5312E01F2EF1350B310' +
'C87F4B404D2F90FF92809A1E20FF0101355380FC9BF8D50000A43' +
'10EF6');
Rod := DTMFromString('78DA637460626078CE8002221C7818D881342' +
'310FF0702465FA09AAB0C6880094C3242798C4E40FE5D026AAC81' +
'FCA704D49801F9AF08A8B107F23FE1570300A89F0BA3');
Bait := DTMFromString('78DA63CC60626078CE8002D6D54930B003694' +
'620FE0F048C594035B719D00013986484F2181380FC3704D41401' +
'F96F09A829C0740F869A6A20FF197E3500A5FA0D61');
end;
Procedure FreeDTMs;
begin
FreeDTM(Shrimp);
FreeDTM(Anchovie);
FreeDTM(Sardine);
FreeDTM(Herring);
FreeDTM(Net);
FreeDTM(Rod);
FreeDTM(Bait);
end;
Procedure Bitmaps;
begin
PlainWater := BitmapFromString(24, 23, 'beNqbNL9r0igaRaN' +
'oFI2iUUQvBAAzoLtm');
end;
Procedure Antiban; //Credits to Ultra for a couple of these. :)
var x, y: Integer;
begin
case random(120)+1 of
1: MMouse(Random(500), Random(500), Random(500), Random(500));
2: SleepAndMoveMouse(random(5000));
3: IdleTime(Random(5000), 2, 5.2);
4: PickUpMouse;
5: RandomRClick;
6: if MouseSpeed < 15 then
IncEx(MouseSpeed, Random(5))
else
DecEx(MouseSpeed, Random(5));
7: begin
GetMousePos(x, y);
MMouse(x, y, 100, 100);
end;
8: BoredHuman;
end;
end;
Function Walk(where: String):Boolean;
begin
if not loggedin then exit;
case where of
'water': if RadialWalkTolWait(FindWaterColor, 5, 200, 215, 75, -5, 5, 4, 30) then Result := True else Result:=False;
'bank': if RadialWalkTolWait(3355960, 18, 10, 50, 67, 1, 1, 0, 5) then Result := True else Result:=False;
end;
end;
Procedure ProgressReport;
var
MultiplyBy : Integer;
LevelText : String;
begin
if Players[CurrentPlayer].Integers[3] > 0 then
begin
myFile := RewriteFile('C:\Windows\Temp\DFNB_temp.txt',false);
if Method = 'net' then MultiplyBy := 27 else MultiplyBy := 26;
WriteFileString(myFile, '....................DRAYNOR FISH N BANK....................'+chr(13));
WriteFileString(myFile, PadR(':', 58) + ':'+chr(13));
WriteFileString(myFile, PadR(': Player: ' + Players[CurrentPlayer].Name, 58) + ':'+chr(13));
WriteFileString(myFile, PadR(': Total Loads Done: ' + IntToStr(Players[CurrentPlayer].Integers[3]) + '. That''s ' + IntToStr(Players[CurrentPlayer].Integers[3]*MultiplyBy) + ' Fish!', 58) + ':'+chr(13));
WriteFileString(myFile, PadR(': Unless you have extra items in your inv. ;)', 58) + ':'+chr(13));
if Players[CurrentPlayer].Integers[4] = 1 then LevelText:='level';
if Players[CurrentPlayer].Integers[4] = 0 then LevelText:='levels';
if Players[CurrentPlayer].Integers[4] > 1 then LevelText:='levels';
WriteFileString(myFile, PadR(': You have gained ' + IntToStr(Players[CurrentPlayer].Integers[4]) + ' ' + LevelText + ' on this player.', 58) + ':'+chr(13));
WriteFileString(myFile, PadR(':' + Completed, 58) + ':'+chr(13));
WriteFileString(myFile, PadR(':', 58) + ':'+chr(13));
WriteFileString(myFile, '...........................................................'+chr(13));
WriteFileString(myFile, ': By jimmy_mac :'+chr(13));
WriteFileString(myFile, '...........................................................'+chr(13)+chr(13));
end;
end;
Procedure LogToDebug;
var
text : string;
begin
CloseFile(myFile);
myFile := OpenFile('C:\Windows\Temp\DFNB_temp.txt',false);
ReadFileString(myFile, text, fileSize(myFile));
writeln(text);
CloseFile(myFile);
end;
procedure CatchColors;
var
DTMx, DTMy, i, b : Integer;
DTMArray: TVariantArray;
begin
LoadDTMs;
i := 0;
SetArrayLength(CatchColor, i+1);
SetArrayLength(DTMArray, 4);
DTMArray := [Shrimp, Anchovie, Sardine, Herring];
for b := 0 to High(DTMArray) do
if FindDTM(DTMArray[b], DTMx, DTMy, MIX1, MIY1, MIX2, MIY2) then
begin
SetArrayLength(CatchColor, i+1);
CatchColor[i] := GetColor(DTMx, DTMy);
i:= i+1;
end;
FreeDTMs;
end;
Function FindEquipment:Boolean;
var
X, Y : Integer;
begin
LoadDTMs;
if FindDTM(Net, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
Method := 'net';
MethodChoose := 'et';
Result := True;
end else
if FindDTM(Rod, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
if FindDTM(Bait, X, Y, MIX1, MIY1, MIX2, MIY2) then
begin
Method := 'rod';
MethodChoose := 'ait Fis';
Result := True;
end else Debug('Found rod, but no bait. :(');
end else
begin
Debug('Equipment Not Found!');
Logout;
MakePlayerInactive;
Result := False;
end;
FreeDTMs;
end;
Function MiniMap2MainScreen(x, y : Integer) : TPoint;
begin
if InRange(x, 600, 652) and InRange(y, 68, 102) then
begin
result.x := round((x - 599) * 9.846153);
result.y := round((y - 67) * 9.823529);
end;
end;
Function FindTheFishSpot: Boolean;
var
x, y, FSx, FSy, Margin : Integer;
FS_TPoint : TPoint;
begin
Margin := 0;
Repeat
Margin := Margin + 50;
if FindSymbol(FSx, FSy, 'fish') then FS_TPoint := MiniMap2MainScreen(FSx, FSy) else
begin
Debug('Couldn''t find the fishing symbol.');
Result := False;
ProgressReport;
MakePlayerInactive;
Exit;
end;
if FindColorSpiralTolerance(x, y, 11840937, FS_TPoint.x - Margin, FS_TPoint.y - Margin, FS_TPoint.x + Margin, FS_TPoint.y + Margin, 12) then
begin
MMouse(x, y, 2, 2);
wait(100 + random(300));
case random(4)+1 of //I prefer like this because this is how I would do it if I was playing.
1..3: mouse(x, y, 1, 1, true);
4: begin
Mouse(x, y, 1, 1, false);
wait(300 + random(300));
ChooseOption(MethodChoose);
end;
end;
FindFishAttempts := 0;
Result:=True;
wait(1000 + random(500));
exit;
end;
until(Margin >= 150);
Inc(FindFishAttempts);
Result:=False;
end;
Procedure ClearVars;
var
i : Integer;
begin
for i := 0 to HowManyPlayers - 1 do
begin
Players[i].Integers[3] := 0;
Players[i].Integers[4] := 0;
if Players[i].Integers[0] = 0 then Players[i].Integers[0] := 100000000; //Random High Number.
if Players[i].Integers[1] = 0 then Players[i].Integers[1] := 100000000; //Random High Number.
end;
end;
Procedure Setup;
begin
SetupSRL;
wait(500);
DeclarePlayers;
if (not (loggedIn)) then LoginPlayer;
SymbolAccuracy := 0.4;
ClearVars;
end;
procedure WalkingToTheFish;
var
MMx, MMy : Integer;
begin
if not loggedin then exit;
if InvFull then exit;
FindNormalRandoms;
Setrun(true);
if FindSymbol(MMx, MMy, 'fish') then
begin
Status('Found Fish Symbol. Walking to It.');
Mouse(MMx, MMy, 5, 5, true);
wait(2500+random(1000));
FFlag(1);
end else
if Walk('water') then
begin
Status('Found Fishing Spot. Walking to It.');
if FindSymbol(MMx, MMy, 'fish') then Mouse(MMx, MMy, 5, 5, true);
end else
begin
Debug('Couldn''t walk to Fishing Spot. Exiting');
logout;
ProgressReport;
MakePlayerInactive;
end;
end;
Function InactiveWater:Boolean;
var
a, i, x, y : Integer;
begin
Bitmaps;
for i := 0 to 3 do
begin
if FindBitmapToleranceIn(PlainWater, x, y, 205, 173, 230, 198, 6) then
begin
inc(a);
wait(150);
end else wait(150);
end;
FreeBitmap(PlainWater);
if a >= 4 then
begin
Debug('Found Inactive water.');
Result := True;
end else
begin
Debug('Found Active water.');
Result := False;
end;
end;
procedure Fishing;
var
MMx, MMy, FishingStart, LastInvCount : Integer;
begin
FindFishAttempts := 0;
FishingMax := Players[CurrentPlayer].Integers[2]*1000;
StillFishing := False;
Status('Fishing');
Repeat
if InRange(compassInt, 5, 355) then makeCompass(355 + random(10));
if not loggedin then exit;
SetAngle(True);
if LevelUp then
begin
Inc(Players[CurrentPlayer].Integers[4]);
if Players[CurrentPlayer].Integers[4] >= Players[CurrentPlayer].Integers[0] then
begin
Completed := 'Gained set amount of levels for this player.';
Debug(Completed);
Logout;
ProgressReport;
MakePlayerInactive;
exit;
end;
end;
FindNormalRandoms;
if FindWhirlPoolMS then
begin
debug('Found Whirlpool');
HandleWhirlPool;
end;
GameTab(tab_Inv);
Debug('Running Antiban');
Antiban;
if not loggedin then exit;
if FindFishAttempts >= 5 then
begin
if not loggedin then exit;
Debug('Couldn''t find a spot to fish :(');
Logout;
MakePlayerInactive;
exit;
end;
if not FindEquipment then
begin
if not loggedin then exit;
Debug('Couldn''t Find Equipment in Inventory :(');
Logout;
ProgressReport;
MakePlayerInactive;
exit;
end;
if InvFull then Exit;
if not StillFishing then
begin
if InvFull then Exit;
if FindTheFishSpot then
begin
if not loggedin then exit;
Debug('Found a spot to fish.');
StillFishing := True;
MarkTime(FishingStart);
LastInvCount := InvCount;
if InvFull then Exit;
end else
begin
if not loggedin then exit;
if FindSymbol(MMx, MMy, 'fish') then Mouse(MMx, MMy, 5,5, true);
fflag(1);
Debug('Couldn''t find a spot to fish. Walking to fish symbol to try again.');
LastInvCount := InvCount;
wait(1500 + random(500));
FindFishAttempts := FindFishAttempts + 1;
MarkTime(FishingStart);
end;
end;
if InactiveWater then
begin
if not loggedin then exit;
if InvFull then Exit;
StillFishing := False;
LastInvCount := InvCount;
end;
if InvCount > LastInvCount then
begin
if not loggedin then exit;
if InvFull then Exit;
Debug('Caught a fish.');
LastInvCount := InvCount;
MarkTime(FishingStart);
StillFishing := True;
end;
if (TimeFromMark(FishingStart)>=FishingMax) then
begin
if not loggedin then exit;
if InvFull then Exit;
Debug('Havn''t caught a fish in ' + IntToStr(FishingMax)+ ' seconds');
StillFishing := False;
LastInvCount := InvCount;
end;
until(not LoggedIn or InvFull);
end;
procedure WalkingToTheBank;
var
MMx, MMy : Integer;
begin
if not loggedin then exit;
FindNormalRandoms;
Setrun(true);
if FindSymbol(MMx, MMy, 'bank') then
begin
Status('Found Bank Symbol. Walking to It.');
Debug('Found Bank Symbol. Walking to It.');
Mouse(MMx, MMy, 5, 5, true);
FFlag(8);
wait(200 + random(300));
end else
if Walk('bank') then Status('Found Bank Symbol. Walking to It.') else
begin
Debug('Couldn''t walk to Bank. Exiting');
logout;
ProgressReport;
MakePlayerInactive;
end;
end;
Procedure Banking;
var
ColorsFound, i, b, x, y, BankX, BankY : Integer;
Bank : TPoint;
begin
if not loggedin then exit;
FindNormalRandoms;
Status('Banking');
b := 0;
if random(5) = 0 then Antiban;
SetAngle(True);
repeat
if not OpenBankFast('db') then
if not OpenBank('db', False, False) then
if not OpenBankQuiet('db') then
if not OpenBankNPC then
if not OpenBankGlass('db', False, False) then
begin
Debug('Couldn''t open bank, changing location, retrying.');
if FindColorTolerance(BankX, BankY, 3355960, 602, 68, 652, 99, 18) then
begin
Bank := MiniMap2MainScreen(BankX, BankY);
Mouse(Bank.x, Bank.y, 5, 5, true);
FFlag(5);
end;
end;
inc(b);
wait(200+random(150));
until((b >= 5) or BankScreen or PinScreen);
if PinScreen then
begin
Debug('Found Pin Screen Inputting PIN.');
InPin(Players[CurrentPlayer].Pin);
wait(400+random(300));
end;
if BankScreen then
begin
Debug('Found Bank Screen.');
CatchColors;
ColorsFound := GetArrayLength(CatchColor);
if ColorsFound = 0 then
begin
Debug('Array has no colors');
Logout;
ProgressReport;
MakePlayerInactive;
Exit;
end;
if not loggedin then exit;
if random(2) = 0 then swap(CatchColor[0],CatchColor[1]); //So it doesnt always click on the shrimps first.
for i:=0 to ColorsFound-1 do
If findcolortolerance(x, y, CatchColor[i], MIX1, MIY1, MIX2, MIY2, 5) then
begin
Debug('Depositing Fish');
Mouse(x, y, 4, 4, false);
wait(50+random(100));
ChooseOption('osit-All');
wait(500+random(400));
Players[CurrentPlayer].Integers[3] := Players[CurrentPlayer].Integers[3] + 1;
if (Players[CurrentPlayer].Integers[3] >= Players[CurrentPlayer].Integers[1]) then
begin
Completed := 'Banked the set amount of loads for this player.';
Debug(Completed);
Logout;
ProgressReport;
MakePlayerInactive;
end;
end;
case random(3)+1 of
1: CloseBank;
end;
end else
begin
if not loggedin then exit;
Debug('Couldn''t open bank screen');
Logout;
ProgressReport;
MakePlayerInactive;
end;
end;
begin
Setup;
Repeat
WalkingToTheFish;
Fishing;
WalkingToTheBank;
Banking;
until(AllPlayersInactive);
LogToDebug;
end.