Emaziz
2011-03-21 16:52:32
How Long have You Played Runescape?
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C++
Are you a member of any other communities?
Registered on most of them, active on none of them (Villavu <3)
Tell us about yourself…
Please show us one (or multiple) of your scripts.
I assume most of you have seen my three reflection scripts emPick, emHerb and Teh Flax Spinner. They are all good (I think), but since you fancy pants aren't such big fans of pure reflection scripts, I've spent some time writing a reflection fisher … with FULL color support! Yes, for the first time in my history I've written a useful script that doesn't rely on hooks. But of course, reflection is faster.
I present… emFish!
What it supports:
- Al-kharid:
- Netting
- Baiting
- Banking
- Barbarian Village
- Luring
- Baiting
- Cooking at fire in helmet shop
- Powerfishing
- Breaking
- Antiban
- Antirandoms
- Paint-on and printed reports
All the above functions are fully supported by reflection and color.
The color features uses TPAs, pixelshifting and DTMs for various functions. The color version does not check XP gained, simply because the GetXP function from SRL library doesn't work 90% of the time (to me at least?).
Oh.. And if using color, try not to wear black or dark clothes while luring or baiting :p
Reflection is more efficient than color and it also shows experience for both cooking and reflection in the paint-on report.
I've only tested the script for 1-3 hours on each combination (powerfishing, cooking, bait, lure, net etc) so there are probably bugs I haven't detected, but from what I've seen it is pretty stable.
So… Enjoy!
7 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
C++
Are you a member of any other communities?
Registered on most of them, active on none of them (Villavu <3)
Tell us about yourself…
From: Emaziz
I'm Aleksander, I'm 17 years old and I live in Norway! I currently have two homes: the boarding school and well, home.
At school I'm the asocial smart guy who just sits on his room in front of the computer all day. So basically my interests are whatever you can do on a computer :)
Please show us one (or multiple) of your scripts.
I assume most of you have seen my three reflection scripts emPick, emHerb and Teh Flax Spinner. They are all good (I think), but since you fancy pants aren't such big fans of pure reflection scripts, I've spent some time writing a reflection fisher … with FULL color support! Yes, for the first time in my history I've written a useful script that doesn't rely on hooks. But of course, reflection is faster.
I present… emFish!
What it supports:
- Al-kharid:
- Netting
- Baiting
- Banking
- Barbarian Village
- Luring
- Baiting
- Cooking at fire in helmet shop
- Powerfishing
- Breaking
- Antiban
- Antirandoms
- Paint-on and printed reports
All the above functions are fully supported by reflection and color.
The color features uses TPAs, pixelshifting and DTMs for various functions. The color version does not check XP gained, simply because the GetXP function from SRL library doesn't work 90% of the time (to me at least?).
Oh.. And if using color, try not to wear black or dark clothes while luring or baiting :p
Reflection is more efficient than color and it also shows experience for both cooking and reflection in the paint-on report.
I've only tested the script for 1-3 hours on each combination (powerfishing, cooking, bait, lure, net etc) so there are probably bugs I haven't detected, but from what I've seen it is pretty stable.
So… Enjoy!
{******************************************************************************}
{*Script: emFish
{*Author: Emaziz
{* Info: * emFish is a full color script that can fish and bank in Al-Kharid,
{* or fish and cook and drop in Barbarian Village.
{* * Comment out line 11 in order to use color (if ref is outdated)
{* * Look at the consts at lines 18-20 and fill in DeclarePlayer
{* variables according to the comments in DeclarePlayers
{******************************************************************************}
{.include SRL\SRL\misc\SMART.SCAR}
{.include SRL\SRL.SCAR}
//{$DEFINE REFLECTION}
{$IFDEF REFLECTION}
{.include Reflection\Reflection.simba}
{$ENDIF}
//Do not edit\\
const
TYPE_LURE = 0; LOC_ALKHARID = 0;
TYPE_BAIT = 1; LOC_BARBARIAN = 1;
TYPE_NET = 2;
cVersion = 'v1.00';
// Do edit \\
doDebug = true;
cAntiban = 1000; // Antiban chance is 5000 divided by cAntiban
procedure declarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Active := True;
Booleans[0] := True; // Want breaks? (If multiple players it will change player instead of breaking)
Integers[0] := 60; // How many minutes between each break. +- 12%.
Integers[1] := TYPE_LURE; // Whether to bait, net or lure. TYPE_BAIT, TYPE_LURE or TYPE_NET
Integers[2] := LOC_BARBARIAN; // Whether to fish in Al-Kharid or Barb village. LOC_ALKHARID or LOC_BARBARIAN
Booleans[1] := True; // Cook fish. Only if LOC_BARBARIAN
Integers[3] := 1000 // Fish to fish
end;
end;
// Stop editing \\
var
DTM_Equipment, DTM_Bait, BMP_Helm_shop, DTM_Button, DTM_Raw_trout,
DTM_Raw_pike, DTM_Raw_salmon, vNextBreak, vPreviousBreak, vBreakTime: longInt;
vFailCount, vRodSlot, vBaitSlot: integer;
procedure freeScript;
begin
try
FreeDTM(DTM_Equipment);
FreeDTM(DTM_Bait);
FreeBitmap(BMP_Helm_shop);
FreeDTM(DTM_Button);
except
end;
end;
{*function Debug, debugs if doDebug is true.*}
procedure debug(s:string);
begin
if doDebug then
writeln('['+TheTime+'] ' + s);
end;
{*function HasBait, returns a boolean telling whether I have the required bait *}
{* and sets vBaitSlot. *}
function HasBait: boolean;
var x,y: integer; {$IFDEF REFLECTION} item: TInvItem; {$ENDIF}
begin
{$IFDEF REFLECTION}
case Players[CurrentPlayer].Integers[1] of
TYPE_NET:
begin
result := True;
vBaitSlot := -1;
exit;
end;
TYPE_LURE:
begin
result := R_ItemExists(314,item);
vBaitSlot := item.Slot;
end;
TYPE_BAIT:
begin
result := R_ItemExists(313,item);
vBaitSlot := item.Slot;
end;
end;
{$ELSE}
if not BankScreen then
GameTab(tab_Inv);
case Players[CurrentPlayer].Integers[1] of
TYPE_NET:
begin
result := True;
vBaitSlot := -1;
exit;
end;
TYPE_LURE..TYPE_BAIT:
result := FindDTM(DTM_Bait,x,y,MIX1,MIY1,MIX2,MIY2);
end;
if result then
begin
vBaitSlot := CoordstoItem(x,y);
//debug('Detected bait in slot ' + ToStr(vBaitSlot));
end
else
begin
vBaitSlot := -1;
debug('Did not find any bait in inventory');
end;
{$ENDIF}
end;
{*function HasRod, returns a boolean telling whether I have the required rod/net*}
{* and sets vRodSlot. *}
function HasRod: boolean;
var x,y: integer; {$IFDEF REFLECTION} item: TInvItem; {$endif}
begin
{$IFDEF REFLECTION}
case Players[CurrentPlayer].Integers[1] of
TYPE_NET:
begin
result := R_ItemExists(303,item);
vRodSlot := item.Slot;
end;
TYPE_LURE:
begin
result := R_ItemExists(309,item);
vRodSlot := item.Slot;
end;
TYPE_BAIT:
begin
result := R_ItemExists(307,item);
vRodSlot := item.Slot;
end;
end;
{$ELSE}
if not BankScreen then
GameTab(tab_Inv);
result := FindDTM(DTM_Equipment,x,y,MIX1,MIY1,MIX2,MIY2);
if result then
begin
vRodSlot := CoordsToItem(x,y);
//debug('Detected rod/net in slot ' + Tostr(vRodSlot));
end
else
begin
vRodSlot := -1;
debug('Did not find the required rod/net in inventory');
end;
{$ENDIF}
end;
{*function HasRawFish, returns a boolean telling whether I have raw salmon, trout or pike*}
{* also sets the given variable to the slot food is located in *}
function HasRawFish(var slot: integer): boolean;
var {$IFNDEF REFLECTION}x,y, p1,p2,p3: tpoint; s1,s2,s3:integer;{$ELSE} items: TInvItemArray;{$ENDIF}
begin
{$IFDEF REFLECTION}
result := R_ItemExistsEx([349,331,335],items);
if result then
slot := items[0].Slot
else
slot := 0;
{$ELSE}
result := False;
FindDTM(DTM_Raw_trout ,p1.x,p1.y,MIX1,MIY1,MIX2,MIY2);
FindDTM(DTM_Raw_salmon,p2.x,p2.y,MIX1,MIY1,MIX2,MIY2);
FindDTM(DTM_Raw_pike ,p3.x,p3.y,MIX1,MIY1,MIX2,MIY2);
s1 := CoordstoItem(p1.x,p1.y);
s2 := CoordstoItem(p2.x,p2.y);
s3 := CoordstoItem(p3.x,p3.y);
slot := 100;
if (s1 > 0) then slot := s1;
if (s2 > 0) and (s2 < slot) then slot := s2;
if (s3 > 0) and (s3 < slot) then slot := s3;
if slot <> 100 then
result := True
else
slot := 0;
{$ENDIF}
end;
{*procedure DropItems, drops all items except fishing equipment*}
procedure dropItems;
var i: integer; path: array of integer;
begin
case random(4) of
0: path := [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28];
1: path := [1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13,17,18,19,20,24,23,22,21,25,26,27,28];
2: path := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
3: path := [1,5,9,13,17,21,25,26,22,18,14,10,6,2,27,23,19,15,11,7,3,28,24,20,16,12,8,4];
end;
for i:=0 to 27 do
if (path[i] <> vRodSlot) and (path[i] <> vBaitSlot) and (ExistsItem(path[i])) then
begin
MouseItem(path[i],false);
wait(50+random(50));
ChooseOption('rop');
wait(100+random(200));
end;
// Calls it twice to make sure all items are dropped
for i:=0 to 27 do
if (path[i] <> vRodSlot) and (path[i] <> vBaitSlot) and (ExistsItem(path[i])) then
begin
MouseItem(path[i],false);
wait(100+random(100));
ChooseOption('rop');
wait(100+random(200));
end;
end;
{*procedure Terminate, performs final actions and terminates script.*}
procedure terminate(reason:string);
begin
debug('*** ERROR *** ' + reason + '. Terminating!');
freeScript;
TerminateScript;
end;
{*function TimeToStr, converts a time integer into a time string*}
function TimeToStr(ms: integer; short: boolean): string;
var
hours, mins, secs, h, m, s: string;
begin
if short then
begin
h := 'h, '; m := 'm, '; s := 's.';
end
else
begin
h := ' hours(s), '; m := ' minute(s), '; s := ' second(s).';
end;
if floor(ms/3600000) > 0 then
begin
hours := (inttostr(floor(ms/3600000)) + h);
end;
if floor(ms/60000) > 0 then
begin
mins := (inttostr(floor(ms/60000)-(60*floor(ms/3600000))) + m);
end;
if floor(ms/1000) > 0 then
begin
secs := (inttostr(floor(ms/1000)-(60*floor(ms/60000))) + s);
end;
Result := (hours + mins + secs);
end;
{$IFDEF REFLECTION}
{*function round2, rounds an extended to a given amount of decimals*}
function round2(Number: extended;Places: longint): extended;
begin
result := round((Number*pow(10, places))/(pow(10, places)));
end;
{*function DDTile, returns a tile based on given distance *}
{*and direction from a given tile. *}
function DDTile(Start: TTile; Direction: integer; Distance: integer): TTile;
var x1, y1, x2, y2: integer; am: extended;
begin
x1 := Start.x;
y1 := Start.y;
am := cose(Direction);
x2 := x1 + round(Distance * am);
am := sine(Direction);
y2 := y1 + round(Distance * am);
Result := Tile(x2,y2);
//debug('Created a DDTile');
end;
{*function Direction, returns the direction from one tile to another*}
function Direction(Start,Endt: TTile): integer;
var
x,y,d:integer;
begin
x := Endt.x - Start.x;
y := Endt.y - Start.y;
d := Distance(Start.x,Start.y,Endt.x,Endt.y);
Result := round(arctan2(y,x)*180/pi);
end;
function WalkTo(goal: TTile): boolean;
var curTile: TTile;
begin
if WalkToTile(goal,0,0) then
debug('Successfully walked to tile ' + tostr(GetMyPos) + '!')
else // If goal is off minimap
begin // Move closer to goal
CurTile := DDTile(GetMyPos,Direction(GetMyPos,goal),14);
WalkToTile(CurTile,4,4);
while (not WalkToTile(Goal,0,0)) do
begin
CurTile := DDTile(GetMyPos,Direction(GetMyPos,goal),15);
if not WalkToTile(CurTile,4,4) then wait(1000);
end;
end;
end;
{$ENDIF}
{*procedure DoBank, performs all banking actions*}
procedure doBank;
var i, x, y, attempts: integer; t: Tpoint; time: longInt;
begin
// Open bank \\
MakeCompass('n');
while (not BankScreen) and (not PinScreen) do
begin
{$IFDEF REFLECTION}
if not R_OpenBankBooth('akb') then
{$ELSE}
if not OpenBankNPC then
{$ENDIF}
begin
attempts := attempts + 1
debug('Can''t open bank');
end;
if attempts > 3 then exit;
end;
// Enter pin, if pin screen //
if PinScreen then InPin(Players[CurrentPlayer].Pin);
if not BankScreen then wait(1000);
if not BankScreen then exit;
// Deposit items \\
if Players[CurrentPlayer].Integers[1] = TYPE_NET then
i := 1
else
i := 2;
for i:=1 to 28 do
if (vRodSlot <> i) and (vBaitSlot <> i) and ExistsItem(i) then
begin
debug('Depositing item at slot ' + ToStr(i));
Deposit(i,i,True);
wait(200+random(200));
end;
//// Withdraw rod and/or bait \\\\
//Check for rod\\
if not HasRod then
begin
writeln('Withdrawing rod');
{$IFDEF REFLECTION}
case Players[CurrentPlayer].Integers[1] of
TYPE_NET:
i := 303;
TYPE_LURE:
i := 309;
TYPE_BAIT:
i := 307;
end;
if R_WithdrawItem(i,1) then
wait(1)
{$ELSE}
if FindDTM(DTM_Equipment,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
t := MSTPointToBankPoint(Point(x,y));
Withdraw(t.x,t.y,1);
wait(800+random(500));
HasRod;
end
{$ENDIF}
else
Terminate('Could not find equipment in bank');
wait(300+random(200));
end;
//Check for bait\\
if not HasBait then
begin
writeln('Withdrawing bait');
{$IFDEF REFLECTION}
case Players[CurrentPlayer].Integers[1] of
TYPE_LURE:
i := 314;
TYPE_BAIT:
i := 313;
end;
if not R_WithdrawItem(i,-1) then
Terminate('Could not withdraw bait');
{$ELSE}
case Players[CurrentPlayer].Integers[1] of
TYPE_LURE:
if FindDTM(DTM_Bait,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
t := MSTPointToBankPoint(Point(x,y));
Withdraw(t.x,t.y,1);
end
else
Terminate('Could not find feathers in bank');
TYPE_BAIT:
if FindDTM(DTM_Bait,x,y,MSX1,MSY1,MSX2,MSY2) then
begin
t := MSTPointToBankPoint(Point(x,y));
Withdraw(t.x,t.y,1);
wait(800+random(500));
end
else
Terminate('Could not find bait in bank');
end;
{$ENDIF}
HasBait;
wait(300+random(200));
end;
// Maybe close bank
if random(100) > 80 then CloseBank;
end;
{*function findFire, locates a fire on the MS*}
function findFire(var t: Tpoint): boolean;
var {$IFNDEF REFLECTION}tt: longInt; tpa1, tpa2, tpa3, tpa4: TPointArray; x,y: integer;
{$ELSE} obj:TRSObject; {$ENDIF}
begin
{$IFDEF REFLECTION}
obj := GetObjectByID(5500,OBJECT_TYPE_FLOORDECOR,10);
if TileOnMS(obj.Tile,0) then
begin
result := True;
t := TileToMS(obj.Tile,0);
end;
{$ELSE}
tt := GetSystemTime;
while not result do
begin
result := (FindColorsSpiralTolerance(x,y,tpa1,7452122,MSX1,MSY1,MSX2,MSY2,5)) or
(FindColorsSpiralTolerance(x,y,tpa2,9030125,MSX1,MSY1,MSX2,MSY2,5)) or
(FindColorsSpiralTolerance(x,y,tpa3,4231359,MSX1,MSY1,MSX2,MSY2,5));
if result then
begin
tpa4 := CombineTPA(CombineTPA(tpa1,tpa2),tpa3);
t := middleTPA(tpa4);
exit;
end;
if GetSystemTime - tt > 1000 then exit;
wait(50+random(10));
end;
{$ENDIF}
end;
{*function isCooking, returns a boolean telling whether the player is cooking or not*}
function isCooking: boolean;
var {$IFNDEF REFLECTION}bmp1, bmp2: longInt; box: TBox; w,h,i,ii: integer;{$ELSE}timer: LongInt; ani: integer;{$ENDIF}
begin
{$IFDEF REFLECTION}
timer := GetSystemTime;
while ((GetSystemTime-timer) < 1000) do
begin
ani := GetMe.Animation;
result := (ani <> -1);
if result then exit;
end;
{$ELSE}
box := IntToBox(MIX1,MIY1,MIX2,MIY2);
BMP1 := CreateBitmap(box.x2-box.x1,box.y2-box.y1);
Getbitmapsize(BMP1,w,h);
for i := 0 to w-1 do
begin
for ii := 0 to h-1 do
begin
FastSetPixel(BMP1,i,ii,GetColor(box.x1 + i, box.y1 + ii));
ii := ii + 5;
end;
i := i + 5;
end;
wait(2500);
BMP2 := CreateBitmap(box.x2-box.x1,box.y2-box.y1);
Getbitmapsize(BMP2,w,h);
for i := 0 to w-1 do
begin
for ii := 0 to h-1 do
begin
FastSetPixel(BMP2,i,ii,GetColor(box.x1 + i, box.y1 + ii));
ii := ii + 5;
end;
i := i + 5;
end;
result := (CalculatePixelShift(BMP1,BMP2,IntToBox(0,0,(box.x2 - box.x1 - 1),(box.y2-box.y1-1)))) <> 0;
FreeBitmap(BMP1);
FreeBitmap(BMP2);
{$ENDIF}
end;
{*procedure doCook, cooks all 'Raw' items at fire*}
procedure cookItem(slot: integer);
var attempts, x, y: integer; tp: Tpoint; time: longInt; didclickk: boolean;
begin
if (vBaitslot <> slot) and (vRodSlot <> slot) and ExistsItem(slot) then
begin
MMouseItem(slot);
wait(100+random(100));
{$IFNDEF REFLECTION}
if IsUpText('aw') then
{$ELSE}
if R_IsUpText('Raw') then
{$ENDIF}
begin
attempts := 0;
while (attempts <= 3) and (not didclickk) do
begin
if findFire(tp) then
begin
if not IsUpText('>') then
MouseItem(slot,true);
wait(100+random(50));
MMouse(tp.x,tp.y,1,1);
ClickMouse2(false);
if not ClickText('aw','UpChars',MSX1,MSY1,MSX2,MSY2,true) then
attempts := attempts + 1
else
begin
time := GetSystemTime;
while ((GetSystemTime - time) < 4000) do
begin
if FindDTM(DTM_Button,x,y,MCX1,MCY1,MCX2,MCY2) then
break;
wait(100);
end;
if FindDTM(DTM_Button,x,y,MCX1,MCY1,MCX2,MCY2) then
begin
Mouse(x,y,1,1,true);
wait(1000+random(100));
didclickk := True;
end;
end;
end
else
begin
attempts := attempts + 1;
wait(400+random(200));
end;
end;
end
else
debug('Item was not raw');
end;
end;
{*procedure AntiBan, performs anti-ban actions*}
procedure Antiban;
begin
case random(cAntiBan) of
0..20: HoverSkill('fishing',false);
21..35: PickUpMouse;
36..40: ExamineInv;
41..50: HoverSkill('random',false);
end;
end;
{*procedure WalkToBank, walks to the bank, or fire in Barb village*}
function WalkToBank: boolean;
var x,y, attempts:integer;
begin
case Players[CurrentPlayer].Integers[2] of
LOC_ALKHARID:
{$IFDEF REFLECTION}
result := WalkTo(Tile(3269,3167));
{$ELSE}
while (attempts < 5) do
begin
MakeCompass('n');
if not FindSymbol(x,y,'bank') and not FindColor(x,y,6654386,MMCX-5,MMCY-5,MMCX+5,MMCY+5) then
RadialWalkTolerance(9092814,340,380,70,1,1,10);
if not FindSymbol(x,y,'bank') and not FindColor(x,y,6654386,MMCX-5,MMCY-5,MMCX+5,MMCY+5)then
RadialWalkTolerance (5533332,360,420,60,1,1,10);
if FindSymbol(x,y,'bank') then
begin
Mouse(x+1,y+1,1,1,true);
result := True;
FFlag(0);
Exit;
end
else
if FindSymbol(x,y,'quest') then
begin
Mouse(x-5,y-10,5,5,true);
attempts := attempts + 1;
FFlag(1);
end;
end;
{$ENDIF}
LOC_BARBARIAN:
{$IFDEF REFLECTION}
result := WalkTo(Tile(3075,3428));
{$ELSE}
while (attempts < 3) do
begin
MakeCompass('n');
if not FindBitmapToleranceIn(BMP_Helm_shop,x,y,MMX1,MMY1,MMX2,MMY2,5) and not FindSymbol(x,y,'water') then
RadialWalkTolerance(3103334,260,280,70,1,1,10);
if not FindBitmapToleranceIn(BMP_Helm_shop,x,y,MMX1,MMY1,MMX2,MMY2,5) and not FindSymbol(x,y,'water') then
RadialWalkTolerance (4284785,260,280,60,1,1,10);
if FindBitmapToleranceIn(BMP_Helm_shop,x,y,MMX1,MMY1,MMX2,MMY2,5) then
begin
Mouse(x+3,y+8,1,3,true);
result := True;
FFlag(1);
Exit;
end
else
if FindSymbol(x,y,'water') then
begin
Mouse(x+3,y-3,1,1,true);
result := True;
FFlag(1);
Exit;
end
else
attempts := attempts + 1;
end;
{$ENDIF}
end;
if attempts >= 5 then terminate('Failed to walk to bank/fire :(');
end;
{*function getFishingSpot, returns a point containing the position of fishing spot*}
function getFishingSpot(var t:tpoint):boolean;
var {$IFNDEF REFLECTION}tt: longInt; tpa1, tpa2, tpa3, tpa4: TPointArray; x,y, xx, yy: integer; p: TPoint;{$ELSE}
spot: TNPCArray; i, closest:integer; meTile: TTile; {$ENDIF}
begin
{$IFDEF REFLECTION}
spot := GetNPCs('Fishing spot');
if high(spot) = -1 then exit;
closest := 0;
for i := 0 to high(spot) do
begin
meTile := GetMe.Tile;
if distance(spot[i].Tile.x,spot[i].Tile.y,meTile.x,meTile.y) < distance(spot[closest].Tile.x,spot[closest].Tile.y,meTile.x,meTile.y) then
closest := i;
end;
if TileOnMS(spot[closest].Tile,0) then
begin
result := True;
t := TileToMS(spot[closest].Tile,0);
end;
{$ELSE}
tt := GetSystemTime;
while not result do
begin
result := (FindColorsSpiralTolerance(x,y,tpa1,11841452,MSX1,MSY1,MSX2,MSY2,5)) or
(FindColorsSpiralTolerance(x,y,tpa1,11640984,MSX1,MSY1,MSX2,MSY2,5)) or
(FindColorsSpiralTolerance(x,y,tpa1,11906472,MSX1,MSY1,MSX2,MSY2,5));
if result then
begin
SortTPAFrom(tpa1,Point(MSX1+(MSX2/2),MSY1+(MSY2/2)));
p := tpa1[0];
FindColorsSpiralTolerance(x,y,tpa1,11841452,p.x-15,p.y-15,p.x+15,p.y+15,5);
FindColorsSpiralTolerance(x,y,tpa2,11640984,p.x-15,p.y-15,p.x+15,p.y+15,5);
FindColorsSpiralTolerance(x,y,tpa3,11906472,p.x-15,p.y-15,p.x+15,p.y+15,5);
tpa4 := CombineTPA(CombineTPA(tpa1,tpa2),tpa3);
t := middleTPA(tpa4);
exit;
end;
if GetSystemTime - tt > 300 then exit;
wait(50+random(10));
end;
{$ENDIF}
end;
{*procedure WalkToFishingSpot, walks to the fishing spots*}
procedure WalkToFishingSpot(furthestFish: boolean);
var {$IFNDEF REFLECTION}tpa: TPointArray; attempts, col, sr, er: integer; p: TPoint;{$ELSE}t1, t2, t3: TTile; me: TMe;{$ENDIF}
begin
{$IFDEF REFLECTION}
case Players[CurrentPlayer].Integers[2] of
LOC_ALKHARID:
begin
t1 := Tile(3269,3147);
t2 := Tile(3276,3141);
end;
LOC_BARBARIAN:
begin
t1 := Tile(3103,3424);
t2 := Tile(3109,3433);
end;
end;
me := GetMe;
t3 := GetMe.Tile;
if (distance(t1.x,t1.y,t3.x,t3.y) < distance(t2.x,t2.y,t3.x,t3.y)) then
begin
t3 := t1;
t1 := t2;
t2 := t3;
end;
if furthestFish then
WalkTo(t2)
else
WalkTo(t1);
R_FFlag(1);
{$ELSE}
case Players[CurrentPlayer].Integers[2] of
LOC_ALKHARID:
begin
col := 8896460;
sr := 170;
er := 190;
end;
LOC_BARBARIAN:
begin
col := 2706009;
sr := 80;
er := 100;
end;
end;
while attempts < 3 do
begin
MakeCompass('n');
if not FindSymbols(TPA,'fish') then
RadialWalkTolerance(col,sr,er,72,1,1,20);
if getFishingSpot(p) then exit;
if FindSymbols(TPA,'fish') then
begin
SortTPAFrom(tpa,Point(MMCX,MMCY));
if furthestFish then
Mouse(tpa[high(tpa)].x-1,tpa[high(tpa)].y-1 ,1,1,true)
else
if distance(tpa[0].x,tpa[0].y,MMCX,MMCY) > 20 then
Mouse(tpa[0].x-1,tpa[0].y-1 ,1,1,true);
if not (Players[CurrentPlayer].Integers[2] = LOC_BARBARIAN) and (Players[CurrentPlayer].Booleans[1]) then
FFlag(0);
wait(500+random(500));
exit;
end
else
attempts := attempts + 1;
if attempts >= 3 then terminate('Failed to walk to fishies :\');
end;
{$ENDIF}
end;
{*function fishFishingSpot, attempts to fish from a fishing spot*}
function fishFishingSpot: boolean;
var option: string; p: Tpoint; attempts: integer;
begin
while attempts < 5 do
begin
if not getFishingSpot(p) then
begin
attempts := attempts + 1;
wait(500+random(300));
continue;
end;
case Players[CurrentPlayer].Integers[1] of
TYPE_LURE: option := 'ure';
TYPE_BAIT: option := 'ait';
TYPE_NET : option := 'et';
end;
getFishingSpot(p);
MMouse(p.x-1,p.y-1,1,1);
wait(50+random(50));
{$IFNDEF REFLECTION}
if IsUpText(option) then
{$ELSE}
if R_IsUpText(option) then
{$ENDIF}
begin
ClickMouse2(True);
result := True;
wait(3000+random(2000));
exit;
end
else
begin
ClickMouse2(False);
wait(50+random(50));
{$IFNDEF REFLECTION}
result := ChooseOption(option);
{$ELSE}
result := R_ChooseOption(option);
{$ENDIF}
if result then
begin
wait(3000+random(2000));
exit;
end;
end;
attempts := attempts + 1;
end;
if attempts >= 5 then exit;
end;
{*procedure PrintOnSmart, prints text on SMART client*}
{*Credits to HobboBobbo for this procedure, thanks! *}
procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], UpChars, H);
for B := 0 to High(TTP) do
begin
try
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
except
end;
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
{*procedure paintReport, paints an on-screen progress report on SMART client*}
procedure paintReport;
var FExp, CExp: integer;
begin
FExp := Players[CurrentPlayer].Integers[11] - Players[CurrentPlayer].Integers[10];
CExp := Players[CurrentPlayer].Integers[21] - Players[CurrentPlayer].Integers[20];
PrintOnSmart([' emFish ' + cVersion + ' ~ By Emaziz'],Point(20, 25), 16777215, 8388736);
PrintOnSmart(['Running For: ' + TimeRunning,
'Fish fished: ' + ToStr(Players[CurrentPlayer].Integers[12]),
'',
{$IFDEF REFLECTION}
'F. Experience: ' + ToStr(FExp),
'F. Exp/hour: ' + ToStr(Round2((FExp * 3600) / (GetTimeRunning / 1000),2)),
'C. Experience: ' + ToStr(CExp),
'C. Exp/hour: ' + ToStr(Round2((CExp * 3600) / (GetTimeRunning / 1000),2)),
'',
{$ENDIF}
'Next break: ' + TimeToStr(vNextBreak-GetSystemTime,true),
'Breaks: ' + IntToStr(Players[CurrentPlayer].Integers[13])], Point(20,55), 16777215, 8388736);
//debug('Printed on-screen progress report');
end;
{*procedure printReport, prints a progressreport*}
procedure printReport;
var FExp, CExp: integer;
begin
FExp := Players[CurrentPlayer].Integers[11] - Players[CurrentPlayer].Integers[10];
CExp := Players[CurrentPlayer].Integers[21] - Players[CurrentPlayer].Integers[20];
writeln('~~ emFish ' + cVersion + ' ~ By Emaziz');
writeln('Running For: ' + TimeRunning);
writeln('Fish fished: ' + ToStr(Players[CurrentPlayer].Integers[12]));
writeln('-');
{$IFDEF REFLECTION}
writeln('F. Experience: ' + ToStr(FExp));
writeln('F. Exp/hour: ' + ToStr(Round2((FExp * 3600) / (GetTimeRunning / 1000),2)));
writeln('C. Experience: ' + ToStr(CExp));
writeln('C. Exp/hour: ' + ToStr(Round2((CExp * 3600) / (GetTimeRunning / 1000),2)));
writeln('-');
{$ENDIF}
writeln('Next break: ' + TimeToStr(vNextBreak-GetSystemTime,true));
writeln('Breaks: ' + ToStr(Players[CurrentPlayer].Integers[13]));
writeln('~~fishfishfishfishfishfishfish~~');
//debug('Printed on-screen progress report');
end;
{*procedure setBreaks, sets break variables*}
procedure setBreaks;
begin
vPreviousBreak := GetSystemTime;
debug('Set vPreviousBreak to ' + TheTime);
vNextBreak := GetSystemTime + (Players[CurrentPlayer].Integers[0] * 60000) -
((12*Players[CurrentPlayer].Integers[0] * 60000)/100) +
((random(24)*Players[CurrentPlayer].Integers[0] * 60000)/100);
debug('Set vNextBreak to occur in ' + TimeToStr(vNextBreak-GetSystemTime,false));
end;
{*procedure doBreak, checks whether script should break. Breaks if needed. *}
procedure doBreak;
var lobby: boolean; vBreakStart: longint;
begin
if ((Players[CurrentPlayer].Booleans[0]) and
((vNextBreak - GetSystemTime) < 0)) then
begin
vBreakTime := ((Players[CurrentPlayer].Integers[0]*60000*10)/100)+random((Players[CurrentPlayer].Integers[0]*60000*2)/100)
debug('vBreaktime set to ' + timetostr(vBreakTime,false));
debug('');
vBreakStart := GetSystemTime;
Lobby := True;
if random(100) > 60 then lobby := False;
If (Lobby) then ExitToLobby
else LogOut;
while (vBreakTime-(GetSystemTime - vBreakStart) > 0) do
begin
wait(5000);
writeln('Time remaining: ' + TimeToStr(vBreakTime-(GetSystemTime - vBreakStart),false));
end;
inc(Players[CurrentPlayer].Integers[13]);
setBreaks;
LogInPlayer;
end;
end;
{*function playerPixelShift, returns the pixel shifting for a 100ms interval *}
{* within a box surrounding the player *}
{$IFNDEF REFLECTION}
function playerPixelShift: integer;
var BMP1, BMP2: LongInt; b: TBox; w, h, i, ii: integer;
begin
b := IntToBox(MSX1+((MSX2-MSX1)/2)-15,MSY1+((MSY2-MSY1)/2)-16,MSX1+((MSX2-MSX1)/2)+20,MSY1+((MSY2-MSY1)/2)+14);
BMP1 := CreateBitmap(B.x2-B.x1,B.y2-B.y1);
Getbitmapsize(BMP1,w,h);
for i := 0 to w-1 do
for ii := 0 to h-1 do
FastSetPixel(BMP1,i,ii,GetColor(b.x1 + i, b.y1 + ii));
wait(100);
BMP2 := CreateBitmap(B.x2-B.x1,B.y2-B.y1);
Getbitmapsize(BMP2,w,h);
for i := 0 to w-1 do
for ii := 0 to h-1 do
FastSetPixel(BMP2,i,ii,GetColor(b.x1 + i, b.y1 + ii));
result := CalculatePixelShift(BMP1,BMP2,IntToBox(0,0,(b.x2 - b.x1 - 1),(b.y2-b.y1-1)));
FreeBitmap(BMP1);
FreeBitmap(BMP2);
end;
{$ENDIF}
{*function isFishing, returns a boolean telling whether player is fishing or not*}
function isFishing: boolean;
{$IFNDEF REFLECTION}var t: tpoint; shift: array of integer; time: longInt;
i, ii: integer; b: boolean; {$ENDIF}
begin
{$IFDEF REFLECTION}
result := isCooking;
{$ELSE}
result := False;
if (not getFishingSpot(t)) or InvFull then exit;
case Players[CurrentPlayer].Integers[1] of
TYPE_NET:
begin
time := GetSystemTime;
while GetSystemTime - time < 3000 do
begin
setLength(shift,length(shift)+1);
shift[high(shift)] := playerPixelShift;
end;
for ii := 0 to high(shift) do
begin
if shift[ii] >= 300 then b := True;
if b then break;
end;
if b then
begin
result := True;
debug('Player is fishing');
exit;
end;
end;
TYPE_LURE..TYPE_BAIT:
begin
result := CountColorTolerance(595230,MSX1+((MSX2-MSX1)/2)-15,MSY1+((MSY2-MSY1)/2)-16,MSX1+((MSX2-MSX1)/2)+20,MSY1+((MSY2-MSY1)/2)+14,14) > 0;
if result then
debug('Player is fishing');
end;
end;
{$ENDIF}
if not result then debug('Player is not fishing');
end;
{*procedure setupScript, preparing the script*}
procedure setupScript;
begin
DeclarePlayers;
Smart_Server := 68;
Smart_Members := True;
Smart_Signed := True;
SetupSRL;
LogInPlayer;
SetAngle(true);
{$IFNDEF REFLECTION}
case Players[CurrentPlayer].Integers[1] of
TYPE_BAIT:
begin
DTM_Equipment := DTMFromString('mlwAAAHicY2dgYGBiYWDgAWJeIGYD4l/MDAz/mCHinUwMDLVA3AjE/UDcC8STgLgJiIEq8GDcgBEPhgIAuxMGFw==');
DTM_Bait := DTMFromString('mrAAAAHic42BgYDBnYmBQA2J1JgjbEYitgVgPihMYGRhigTgViNOBOB6II4A4khEit65OAmgKE05sxIAfMBLAMAAAB1cGOQ==');
debug('Loaded DTM_Equipment and DTM_Bait');
end;
TYPE_LURE:
begin
DTM_Equipment := DTMFromString('mbQAAAHicY2VgYGhgYWCoB+JOIK4B4gog1mBiYDABYmkgVgViHSCOc+EFqmZCwf8ZMAEjFgwGAJWCBSM=');
DTM_Bait := DTMFromString('mlwAAAHicY2dgYMhkYWBIAOJiIK6C0jFAnAjEqxgZGNYC8RogXgDEc4F4BxBvBeLVSxYDdTNhxS+YGXACRjwYCgB/Dgqu');
debug('Loaded DTM_Equipment and DTM_Bait');
end;
TYPE_NET:
begin
DTM_Equipment := DTMFromString('mbQAAAHicY2VgYGBlYWBgBmIBIOYE4n/MDAzKTAwMBkCsCcRyQCwPxK5mGkDVTCj4PwMmYMSCwQAAAVYDqg==');
debug('Loaded DTM_Equipment');
end;
end;
{$ENDIF}
if (Players[CurrentPlayer].Integers[2] = LOC_BARBARIAN) and Players[CurrentPlayer].Booleans[1] then
begin
{$IFNDEF REFLECTION}
BMP_Helm_Shop := BitmapFromString(6, 5, 'meJw7cAA7mA8DTc3tQO70iX2Xts/Y' +
'vHULUATItvVdFxB4GohCQyMhDIgyILesvBSIgIoBhE02iQ==');
DTM_Raw_salmon := DTMFromString('mggAAAHicY2NgYGBmYWDgAmJGKP2XmYHhBxBfYILgM0B8EohvAfFVIO4M8wXqYsLAHAzYASMODAEAEScIXg==');
DTM_Raw_trout := DTMFromString('mggAAAHicY2NgYGhiYWCoBeJ2IO4G4kYgLgPiDiYGhjYgbgTiViCeAMV9HR1AXUwYmIMBO2DEgSEAABoPCB0=');
DTM_Raw_pike := DTMFromString('mggAAAHicY2NgYAhjYWAIBuJ4IA4AYh8gjgViO2YGBisgtgZiNyB2AmJTIM6sygTqYsLAHAzYASMODAEA6hkFBg==');
{$ENDIF}
DTM_Button := DTMFromString('mWAAAAHicY2FgYNjMxMCwAYh3Q2kLZgYGRyA2BmJTIA7zc2bwc7NmiApyZ4gIcGUAKkHBjGgYBAC63Qdq');
end;
{$IFDEF REFLECTION}
Players[CurrentPlayer].Integers[10] := R_GetSkillExperience(10);
Players[CurrentPlayer].Integers[11] := Players[CurrentPlayer].Integers[10];
Players[CurrentPlayer].Integers[20] := R_GetSkillExperience(7);
Players[CurrentPlayer].Integers[21] := Players[CurrentPlayer].Integers[20];
{$ENDIF}
HasRod;
HasBait;
SetBreaks;
end;
procedure StartScript;
var p: TPoint; prevCount, slot: integer;
begin
case Players[CurrentPlayer].Integers[2] of
LOC_ALKHARID:
while (Players[CurrentPlayer].Integers[12] < Players[CurrentPlayer].Integers[3]) do
begin
// Walk to bank
if InvFull or not HasBait or not HasRod and getFishingSpot(p) and not BankScreen then
begin
debug('Walking to bank');
WalkToBank;
end;
// Do bank
if InvFull or not HasBait or not HasRod then
begin
debug('Doing banking');
printReport;
doBank;
end;
doBreak;
// Walk to fishies
if Hasbait and Hasrod and not Invfull and (not getFishingSpot(p) or BankScreen) then
begin
debug('Walking to fishing spots');
WalkToFishingSpot(false);
if not getFishingSpot(p) then
WalkToFishingSpot(true);
end;
// Fish fishies
if Hasbait and Hasrod and not Invfull and getFishingSpot(p) and not BankScreen then
begin
debug('Starting to fish');
prevCount := InvCount;
fishFishingSpot;
wait(500+random(100));
while (isFishing and not InvFull and getFishingSpot(p)) do
begin
if prevCount <> InvCount then
begin
Players[CurrentPlayer].Integers[12] := Players[CurrentPlayer].Integers[12] + (InvCount - prevCount);
prevCount := InvCount;
end;
LevelUp;
Antiban;
{$IFDEF REFLECTION}
Players[CurrentPlayer].Integers[11] := R_GetSkillExperience(10);
R_FindRandoms;
{$ELSE}
FindNormalRandoms;
{$ENDIF}
paintReport;
wait(1000+random(1000));
end;
end;
doBreak;
paintReport;
end;
LOC_BARBARIAN:
while (Players[CurrentPlayer].Integers[12] < Players[CurrentPlayer].Integers[3]) do
begin
if not HasRod or not HasBait then
terminate('Can not find rod and/or bait');
// Start walking to fire
if (InvFull) and HasRawFish(slot) and getFishingSpot(p) and
Players[CurrentPlayer].Booleans[1] then
begin
debug('Walking to fire');
WalkToBank;
end;
// Start cooking
if ((InvFull) or (not HasBait) or (not HasRod)) and HasRawFish(slot) and
FindFire(p) and Players[CurrentPlayer].Booleans[1] then
begin
debug('Cooking...');
while HasRawFish(slot) do
begin
debug('Cooking raw fish in slot ' + tostr(slot));
cookItem(slot);
wait(500);
while(isCooking) do
begin
LevelUp;
Antiban;
paintReport;
{$IFDEF REFLECTION}
Players[CurrentPlayer].Integers[21] := R_GetSkillExperience( 7);
{$ENDIF}
wait(1000+random(1000));
end;
end;
end;
doBreak;
// Start walking to fish
if Hasbait and Hasrod and not HasRawFish(slot) and not getFishingSpot(p) then
begin
debug('Walking to fishing spots');
WalkToFishingSpot(false);
if not getFishingSpot(p) then
WalkToFishingSpot(true);
end;
// Start dropping
if InvFull and (not Players[CurrentPlayer].Booleans[1] or not HasRawFish(slot)) then
begin
debug('Starting to drop fish');
printReport;
dropItems;
end;
// Start fishing
if Hasbait and Hasrod and not Invfull and getFishingSpot(p) then
begin
debug('Starting to fish');
prevCount := InvCount;
fishFishingSpot;
wait(500+random(100));
while (isFishing and not InvFull and getFishingSpot(p)) do
begin
if prevCount <> InvCount then
begin
Players[CurrentPlayer].Integers[12] := Players[CurrentPlayer].Integers[12] + (InvCount - prevCount);
prevCount := InvCount;
end;
LevelUp;
Antiban;
{$IFDEF REFLECTION}
Players[CurrentPlayer].Integers[11] := R_GetSkillExperience(10);
R_FindRandoms;
{$ELSE}
FindNormalRandoms;
{$ENDIF}
paintReport;
wait(1000+random(1000));
end;
end;
doBreak;
paintReport;
end;
else
terminate('Incorrect .Integers[2] value');
end;
end;
begin
setupScript;
wait(1000);
StartScript;
freeScript;
end.