SRL Archive - News and General

ProFisher Preview


Tniffoc

2010-08-30 23:39:58

I plan to implement this script into MSI after its completion.

Here's a little preview at my soon-to-be epic fisher.

The script will be fully functional for everything but banking without reflection or with reflection for added stability.

Banking will have to be reflection just because of the unpredictability of color walking in this day and age. Draynor walking will be available in color mode though.


program TProFisher;

//{$define T_REFLECTION}// Comment out this line to disable Reflection BAckup.
{$define T_DEBUG}
{$define SMART}
{$i SRL/SRL.scar}
{$ifdef T_REFLECTION}
{$i Reflection/Reflection.simba}
{$endif}
{$ifdef T_DEBUG}
{$i SRL/SRL/misc/DeBug.scar}
{$endif}

{*******************************************************************************
BEGIN SETUP... FILL STUFF OUT
*******************************************************************************}
const
SMART_World = 82; // Set to 0 for RANDOM

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

with Players[0] do
begin
Name := '********';
Pass := '********';
Strings[0] := 'fly'; // Equip: net, cage, rod, fly
Strings[1] := 'edgeville'; // Location: draynor, edgeville
Booleans[0] := False; // Should we bank?
Integers[0] := 6; // Loads between breaks.
Active := True; // Use this player?
end;

// Uncomment to add more players.
{
with Players[1] do
begin
Name := '';
Pass := '';
Active := True;
end;
}
end;

{*******************************************************************************
END SETUP... STOP FILLING STUFF OUT
*******************************************************************************}
const
ScriptName = 'Tniffoc''s ProFisher';
ScriptVersion = 0.1;
Color_MS_Water = 10598324;
type
TFishInfo = record
WhileFishing: procedure;
SpotColors: TIntegerArray;
EquipInventoryDTMs: TStringArray;
end;
TWalkInfo = record
WalkToBank: procedure;
WalkToLocation: procedure;
end;
var
FishInfo: TFishInfo;
WalkInfo: TWalkInfo;

procedure ScriptWrite(s: String);
var
hours,minutes,seconds: Integer;
begin
ConvertTime(GetSystemTime,hours,minutes,seconds);
Writeln(ScriptName + ' ' + FloatToStr(ScriptVersion) + ' - ' + s);
end;

procedure DeactivatePlayer(p: Integer);
begin
Players[p].Active := False;
Logout;
end;

procedure DeactivateCurrentPlayer;
begin
Players[CurrentPlayer].Active := False;
Logout;
end;

function IsPlayerActive(p: Integer): Boolean;
begin
Result := Players[p].Active;
end;

function IsCurrentPlayerActive: Boolean;
begin
Result := IsPlayerActive(CurrentPlayer);
end;

function HavePlayers: Boolean;
var
i: Integer;
begin
Result := False;
for i:=0 to High(Players) do
if(Players[i].Active) then
begin
Result := True;
Exit;
end;
end;

function ShouldContinue: Boolean;
begin
Result := IsCurrentPlayerActive and LoggedIn();
if not LoggedIn() then
Players[CurrentPlayer].Active := false;
end;

type
THSLColor = record
h: Extended;
s: Extended;
l: Extended;
end;
TRGBColor = record
r: Integer;
g: Integer;
b: Integer;
end;
TXYZColor = record
x: Extended;
y: Extended;
z: Extended;
end;

function GetTolerance(arr: array of Integer; theCTS: Integer): Integer;
var
cts,i: Integer;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(theCTS);
for i:=0 to High(arr)-1 do
begin
Result := 0;
while(not SimilarColors(arr[i],arr[i+1],Result)) do
begin
Inc(Result);
end;
end;
ColorToleranceSpeed(cts);
Inc(Result);
end;

procedure HueSatTolCol(var hue,sat: Extended; var tol,col: Integer; arr: array of Integer; cts: Integer);
var
i,ii,r,g,b: Integer;
hslarr: array of THSLColor;
rgbarr: array of TRGBColor;
xyzarr: array of TXYZColor;
rgbminmax: array[0..1] of TRGBColor;
minmax: array[0..1] of THSLColor;
xyzminmax: array[0..1] of TXYZColor;
h,s,l,x,y,z: Extended;
hmod,smod: Extended;
bestCol: THSLColor;
begin
SetLength(hslarr,Length(arr));
for i:=0 to High(arr) do
begin
ColorToHSL(arr[i],hslarr[i].h,hslarr[i].s,hslarr[i].l);
end;
minmax[0].h := 255;
minmax[0].s := 255;
minmax[0].l := 255;
ii := High(hslarr);
for i:=0 to ii do
begin
minmax[0].h := MinE(minmax[0].h,hslarr[i].h);
minmax[0].s := MinE(minmax[0].s,hslarr[i].s);
minmax[0].l := MinE(minmax[0].l,hslarr[i].l);
minmax[1].h := MaxE(minmax[1].h,hslarr[i].h);
minmax[1].s := MaxE(minmax[1].s,hslarr[i].s);
minmax[1].l := MaxE(minmax[1].l,hslarr[i].l);
end;
h := minmax[1].h - minmax[0].h;
s := minmax[1].s - minmax[0].s;
l := minmax[1].l - minmax[0].l;
hmod := (h/l);
smod := (s/l);
if(hmod < 0.1)then
hmod := 0.1;
if(smod < 0.1) then
smod := 0.1;
hue := hmod;
sat := smod;
if(cts < 2)then
begin
ii := High(arr);
SetLength(rgbarr, ii+1);
for i:=0 to ii do
begin
ColorToRGB(arr[i],rgbarr[i].r,rgbarr[i].g,rgbarr[i].b);
end;
ii := High(rgbarr);
rgbminmax[0].r := 255;
rgbminmax[0].g := 255;
rgbminmax[0].b := 255;
for i:=0 to ii do
begin
rgbminmax[0].r := Min(rgbminmax[0].r, rgbarr[i].r);
rgbminmax[0].g := Min(rgbminmax[0].g, rgbarr[i].g);
rgbminmax[0].b := Min(rgbminmax[0].b, rgbarr[i].b);
rgbminmax[1].r := Max(rgbminmax[1].r, rgbarr[i].r);
rgbminmax[1].g := Max(rgbminmax[1].g, rgbarr[i].g);
rgbminmax[1].b := Max(rgbminmax[1].b, rgbarr[i].b);
end;
r := rgbminmax[1].r - rgbminmax[0].r;
g := rgbminmax[1].g - rgbminmax[0].g;
b := rgbminmax[1].b - rgbminmax[0].b;
col := RGBToColor(r,g,b);
tol := GetTolerance(arr,cts);
end;
if(cts = 2) then
begin
bestCol.h := (minmax[0].h + minmax[1].h) div 2;
bestCol.s := (minmax[0].s + minmax[1].s) div 2;
bestCol.l := (minmax[0].l + minmax[1].l) div 2;
col := HSLToColor(bestCol.h,bestCol.s,bestCol.l);
tol := Round(l + 0.1);
end;
if(cts = 3) then
begin
SetLength(xyzarr,Length(arr));
for i:=0 to High(xyzarr) do
begin
ColorToXYZ(arr[i],xyzarr[i].x,xyzarr[i].y,xyzarr[i].z);
end;
xyzminmax[0].x := 255;
xyzminmax[0].y := 255;
xyzminmax[0].z := 255;
for i:=0 to High(xyzarr) do
begin
xyzminmax[0].x := MinE(xyzminmax[0].x,xyzarr[i].x);
xyzminmax[0].y := MinE(xyzminmax[0].y,xyzarr[i].y);
xyzminmax[0].z := MinE(xyzminmax[0].z,xyzarr[i].z);
xyzminmax[1].x := MaxE(xyzminmax[1].x,xyzarr[i].x);
xyzminmax[1].y := MaxE(xyzminmax[1].y,xyzarr[i].y);
xyzminmax[1].z := MaxE(xyzminmax[1].z,xyzarr[i].z);
end;
x := xyzminmax[1].x - xyzminmax[0].x;
y := xyzminmax[1].y - xyzminmax[0].y;
z := xyzminmax[1].z - xyzminmax[0].z;
col := XYZToColor(x,y,z);
tol := GetTolerance(arr,cts);
end;
end;
function AmaxIndex(a: array of Integer): Integer;
var
m,runner: Integer;
begin
Result := 0;
m := a[0];
for runner:=0 to High(a) do
begin
if a[runner] > m then
begin
m := a[runner];
Result := runner;
end;
end;
end;
function AminIndex(a: array of Integer): Integer;
var
m,runner: Integer;
begin
Result := 0;
m := a[0];
for runner:=0 to High(a) do
begin
if a[runner] < m then
begin
m := a[runner];
Result := runner;
end;
end;
end;
function GetRCircle(TPA: TPointArray): Extended;
var
x,y,distances: TIntegerArray;
i,ii,iii,davg,stdd: Integer;
xleft,xtop,xright,xbottom,center: TPoint;
begin
SetLength(x,Length(TPA));
SetLength(y,Length(TPA));
for i:=0 to High(TPA) do
begin
x[i] := TPA[i].x;
y[i] := TPA[i].y;
end;
i := AmaxIndex(x);
xright := TPA[i];
i := AmaxIndex(y);
xtop := TPA[i];
i := AminIndex(x);
xleft := TPA[i];
i := AminIndex(y);
xbottom := TPA[i];
center := Point((xright.x+xtop.x+xleft.x+xbottom.x) div 4,(xright.y+xtop.y+xleft.y+xbottom.y) div 4);
SetLength(distances,Length(TPA));
for i:=0 to High(TPA) do
begin
ii := TPA[i].x - center.x;
iii := TPA[i].y - center.y;
ii := ii*ii
iii := iii*iii;
distances[i] := Round(sqrt(ii+iii));
end;
davg := 0;
for i:=0 to High(distances) do
begin
IncEx(davg,distances[i]);
end;
davg := davg div Length(distances);
stdd := 0;
for i:=0 to High(distances) do
begin
stdd := stdd + ((distances[i] - davg)*(distances[i] - davg));
end;
stdd := stdd div Length(distances);
Result := sqrt(stdd);
end;
procedure SortATPAByRCircle(var ATPA: T2DPointArray);
var
rs: TExtendedArray;
i,lastPlace,maxLoc: Integer;
temp: TPointArray;
etemp: Extended;
begin
SetLength(rs,Length(ATPA));
for i:=0 to High(ATPA) do
rs[i] := GetRCircle(ATPA[i]);
for lastPlace:=0 to High(rs) do
begin
maxLoc := 0;
for i:=High(rs) downto lastPlace+1 do
begin
if rs[i] < rs[maxLoc] then
maxLoc := i;
end;
etemp := rs[maxLoc];
rs[maxLoc] := rs[lastPlace];
rs[lastPlace] := etemp;
temp := ATPA[maxLoc];
ATPA[maxLoc] := ATPA[lastPlace];
ATPA[lastPlace] := temp;
end;
end;

{$ifdef T_REFLECTION}
procedure R_WhileFishing;
var
startTime: Integer;
begin
MarkTime(startTime);
while(GetAnimation <> -1) do
begin
R_FindRandoms;
wait(500 + random(250));
if(TimeFromMark(startTime) > 30000) then
begin
ScriptWrite('Timed out while waiting for fishing. (REFLECTION)');
Exit;
end;
end;
end;
{$endif}

procedure WhileFishingNet;
var
colors: TIntegerArray;
tolerance,color,cts,begtime: Integer;
huemod,satmod: Extended;
TPA: TPointArray;
begin
colors := [1251616,2833227,2108986,1845300]
HueSatTolCol(huemod,satmod,tolerance,color,colors,2);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
MarkTime(begtime);
while(true) do
begin
if(TimeFromMark(begtime) > 40000) then
begin
ColorToleranceSpeed(cts);
ScriptWrite('Timed out while waiting for fishing. (COLOR)');
Exit;
end;
FindColorsSpiralTolerance(MSCX,MSCY,TPA,color,MSCX-50,MSCY-30,MSCX+50,MSCY+30,tolerance);
ScriptWrite('Size of Net TPA - ' + IntToStr(Length(TPA)));
if(Length(TPA) < 15) then
begin
ColorToleranceSpeed(cts);
Exit;
end;
FindNormalRandoms;
wait(1000 + random(1000));
end;
ColorToleranceSpeed(cts);
end;

procedure WhileFishingCage;
var
colors: TIntegerArray;
tolerance,color,cts,begtime,onetime: Integer;
huemod,satmod: Extended;
TPA: TPointArray;
fishing: Boolean;
begin
colors := [1000809,1000294,866647,801370,734804];
HueSatTolCol(huemod,satmod,tolerance,color,colors,2);
cts := GetColorToleranceSpeed
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(huemod,satmod);
MarkTime(begtime);
while(true) do
begin
if(not LoggedIn) then Exit;
FindNormalRandoms;
if(TimeFromMark(begtime) > 50000) then
begin
ColorToleranceSpeed(cts);
Exit;
end;
MarkTime(onetime);
fishing := false;
while(TimeFromMark(onetime) < 7000) do
begin
FindColorsSpiralTolerance(MSCX,MSCY,TPA,color,MSCX-30,MSCY-30,MSCX+30,MSCY+30,tolerance);
ScriptWrite('Length of Cage TPA - ' + IntToStr(Length(TPA)));
FindNormalRandoms;
if(Length(TPA) > 30) then
begin
fishing := true;
break;
end;
wait(627);
end;
if(not fishing) then
begin
ColorToleranceSpeed(cts);
Exit;
end;
wait(1000 + random(1000));
end;
ColorToleranceSpeed(cts);
end;

function StandardDeviation(arr: TIntegerArray): Extended;
var
n,i: Integer;
mean,dmean: Extended;
begin
mean := 0;
dmean := 0;
n := Length(arr);
for i:=0 to (n-1) do
mean := mean + arr[i];
mean := mean / n;
for i:=0 to (n-1) do
dmean := dmean + ((arr[i]-mean)*(arr[i]-mean));
Result := sqrt(dmean / n);
end;
function PearsonCorrelationCoefficient(TPA: TPointArray): Extended;
var
ex,ey,cov,estd: Extended;
i,n: Integer;
x,y: TIntegerArray;
begin
ex := 0;
ey := 0;
n := Length(TPA);
SetLength(x,n);
SetLength(y,n);
for i:=0 to (n-1) do
begin
ex := ex + TPA[i].x;
ey := ey + TPA[i].y;
x[i] := TPA[i].x;
y[i] := TPA[i].y;
end;
ex := ex / n;
ey := ey / n;
cov := 0;
for i:=0 to High(TPA) do
cov := cov + ((TPA[i].x - ex)*(TPA[i].y - ey));
cov := cov / n;
estd := StandardDeviation(x) * StandardDeviation(y);
if estd = 0 then
begin
Result := 1;
Exit
end;
Result := cov / estd;
end;

function CountSurroundingColors(p: TPoint; col,tol,n: Integer): Integer;
var
count,layer: Integer;
begin
count := 0;
for layer:= 1 to n do
begin
if(SimilarColors(GetColor(p.x,p.y+n),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x+n,p.y+n),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x+n,p.y),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x,p.y-n),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x-n,p.y-n),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x-n,p.y),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x-n,p.y+n),col,tol)) then
Inc(count);
if(SimilarColors(GetColor(p.x+n,p.y-n),col,tol)) then
Inc(count);
end;
Result := count;
end;

procedure WhileFishingRod;
var
cts,begtime,fcount,i,s,s2: Integer;
colors,best,tol: TIntegerArray;
rgb: T2DIntegerArray;
r: Extended;
mods: TExtendedArray;
hsl,xyz: T2DExtendedArray;
TPA,TPA2: TPointArray;
direction: string;
begin
fcount := 0;
colors := [792869,859176,595231,925227,991278];
GetColorArrayInfo(colors,best,tol,mods,rgb,hsl,xyz);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(mods[0],mods[1]);
MarkTime(begtime);
while TimeFromMark(begtime) < 35000 do
begin
if not LoggedIn then
Exit;
FindColorsTolerance(TPA,best[0],MSCX+20,MSCY-30,MSCX+50,MSCY+30,tol[0]+2);
FindColorsTolerance(TPA2,best[0],MSCX-50,MSCY-30,MSCX-20,MSCY+30,tol[0]+2);
if(Length(TPA) <= 1) and (Length(TPA2) <= 1) then
begin
ScriptWrite('Rod Stats: (0 , 0 , nil)');
Break;
end;
if(Length(TPA) > 1) then
s := CountSurroundingColors(MiddleTPA(TPA),Color_MS_Water,80,2)
else
s := 0;
if(Length(TPA2) > 1) then
s2 := CountSurroundingColors(MiddleTPA(TPA2),Color_MS_Water,80,2)
else
s2 := 0;
if(s2 > s) then
begin
s := s2;
SetLength(TPA,Length(TPA2));
for i:=0 to High(TPA2) do
TPA[i] := TPA2[i];
direction := 'left';
end else
direction := 'right';
if(Length(TPA) > 110) then
begin
ScriptWrite('Detected something much larger than the rod. Rod must not be visible.');
Break;
end;
if s <= 0 then
begin
ScriptWrite('TPA not near water. We could have mis-detected rod. I think we''re done fishing.');
Break;
end;
r := PearsonCorrelationCoefficient(TPA);
ScriptWrite('Rod Stats: (' + IntToStr(Length(TPA)) + ' , ' + FloatToStr(r) + ' , ' + direction + ')');
if(Length(TPA) < 25) then
Break
else
if(((r < 0.4) and (r >= 0.0)) or ((r > -0.4) and (r <= 0.0))) then
begin
Inc(fcount);
if(fcount >= 3) then
Break;
end else
fcount := 0;
wait(750 + random(500));
end;
ColorToleranceSpeed(cts);
end;

function GetDTM(name: string): Integer;
begin
case lowercase(name) of
'inv.net': begin
Result := DTMFromString('mbQAAAHicY2VgYDAHYgsg1gFiUyC2B2IXqJg1EPsCsRsQO5toMKADkLgIGmbEgsEAAAtkA5k=');
Exit;
end;
'inv.fly': begin
Result := DTMFromString('mbQAAAHicY2VgYNAGYlUo1gViYyBWAGItIJYDYjEgFgRib1MhBnQQAMQiaJgRCwYDALy8AqE=');
Exit;
end;
'inv.feather': begin
Result := DTMFromString('mbQAAAHicY2VgYDjNyMBwAIivAfEtID4OxLuB4keAeCsQrwTiTUC8aPZsBnRggwUzYsFgAAA9hAql');
Exit;
end;
end;
end;

function FindFishingSpot: TPoint;
var
hmod,smod: Extended;
tol,col,cts,i,mix,miy: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if not ShouldContinue then
Exit;
Result := Point(0,0);
cts := GetColorToleranceSpeed;
HueSatTolCol(hmod,smod,tol,col,FishInfo.SpotColors,2);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(hmod,smod);
FindColorsSpiralTolerance(MSCX,MSCY,TPA,col,MSX1,MSY1,MSX2,MSY2,tol);
if Length(TPA) > 6 then
begin
ATPA := SplitTPAEx(TPA,6,6);
SortATPAByRCircle(ATPA);
for i:=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i],mix,miy);
MMouse(mix,miy,2,2);
Wait(200 + random(300));
if IsUpText('ish') then
begin
GetMousePos(mix, miy);
Writeln('Clicking Fishing Spot: ' + FloatToStr(GetRCircle(ATPA[i])));
Result := Point(mix,miy);
ColorToleranceSpeed(cts);
Exit;
end;
end;
end else
begin
for i:=0 to High(TPA) do
begin
MMouse(TPA[i].x,TPA[i].y,2,2);
Wait(200 + random(300));
if IsUpTextMultiCustom(['hing','ish','pot']) then
begin
GetMousePos(mix,miy);
ColorToleranceSpeed(cts);
Result := Point(mix,miy);
Exit;
end;
end;
end;
ColorToleranceSpeed(cts);
end;

{$ifdef T_REFLECTION}
function R_Fish: Boolean;
var
spots: TNPCArray;
p: TPoint;
i: Integer;
begin
Result := False;
spots := GetNPCsBy('Fishing');
if Length(spots)<1 then
begin
Result := False;
Exit;
end;
for i:=0 to High(spots) do
begin
p := spots[i].pixel;
MMouse(p.x,p.y,2,2);
if IsUpText('ish') then
begin
GetMousePos(p.x,p.y);
Mouse(p.x,p.y,2,2,True);
Result := True;
Exit;

end;
end;
end;
{$endif}

procedure Fish;
var
p: TPoint;
timeout,i: Integer;
Symbols: TPointArray;
begin
if not ShouldContinue then
Exit;
p := Point(0,0);
timeout := 0;
while (p.x = 0) and (p.y = 0) do
begin
p := FindFishingSpot;
Inc(timeout);
if timeout > 11 then
begin
{$ifdef T_REFLECTION}
if R_Fish then
Exit
else begin
ScriptWrite('Failed to find the fishing spot.');
DeactivateCurrentPlayer;
Exit;
end;
{$endif}
{$ifndef T_REFLECTION}
if(lowercase(Players[CurrentPlayer].Strings[1]) = 'edgeville') then
begin
FindSymbols(Symbols,'fish');
for i := 0 to High(Symbols) do
begin
if(Distance(MMCX,MMCY,Symbols[i].x,Symbols[i].y) >= 20) then
begin
ScriptWrite('Symbol Clicking failsafe engaged.');
Mouse(Symbols[i].x,Symbols[i].y,2,2,true);
wait(500 + random(500));
Flag;
wait(1000 + random(750));
Flag;
p := FindFishingSpot;
if(p.x <> 0) and (p.y <> 0) then
begin
Mouse(p.x,p.y,0,0,true);
Exit;
end;
end;
end;
end;
ScriptWrite('Failed to find the fishing spot.');
DeactivateCurrentPlayer;
Exit;
{$endif}
end;
end;
Mouse(p.x,p.y,0,0,True);
end;

procedure FishLoad;
begin
if not ShouldContinue then
Exit;
while not InvFull do
begin
Fish;
Wait(5000 + random(1000));
FindNonInventoryRandoms;
{$ifdef T_REFLECTION}
R_FindRandoms;
{$endif}
FindNormalRandoms;
FishInfo.WhileFishing();
if not ShouldContinue then
Exit;
end;
end;

procedure Bank;
begin
if not ShouldContinue then
Exit;

end;

procedure ClearLoadout;
var
notSpots: TIntegerArray;
p: TPoint;
i,DTM: Integer;
begin
if not ShouldContinue then
Exit;
if(Players[CurrentPlayer].Booleans[0]) then
begin
Bank;
end else
begin
SetLength(notSpots,Length(FishInfo.EquipInventoryDTMs));
for i:=0 to High(FishInfo.EquipInventoryDTMs) do
begin
DTM := GetDTM(FishInfo.EquipInventoryDTMs[i]);
if(DTMRotated(DTM,p.x,p.y,MIX1,MIY1,MIX2,MIY2)) then
begin
notSpots[i] := CoordsToItem(p.x,p.y);
FreeDTM(DTM);
end else
begin
FreeDTM(DTM);
ScriptWrite('Couldn''t find equiptment in your inventory.');
DeactivateCurrentPlayer;
Exit;
end;
end;
DropAllExcept(notSpots);
end;
end;

procedure ToDraynorBank;
begin
// TODO: Walk to draynor bank;
end;

procedure ToEdgevilleBank;
begin
// TODO: Walk to edgeville bank;
end;

procedure ToDraynorLocation;
begin
// TODO: Walk to Draynor fish
end;

procedure ToEdgevilleLocation;
begin
// TODO: Walk to Edgeville fish
end;

procedure SetupScript;
begin
FishInfo.SpotColors := [10787734,10919578,11117986];
{$ifdef T_REFLECTION}
ScriptWrite('Using Reflection backup system.');
{$endif}
end;

procedure SetupPlayer;
begin
if not LoggedIn then
LoginPlayer;
SetAngle(true);
case lowercase(Players[CurrentPlayer].Strings[0]) of
'net': begin
{$ifndef T_REFLECTION}
FishInfo.WhileFishing := @WhileFishingNet;
{$endif}
{$ifdef T_REFLECTION}
FishInfo.WhileFishing := @R_WhileFishing;
{$endif}
SetLength(FishInfo.EquipInventoryDTMs,1);
FishInfo.EquipInventoryDTMs[0] := 'inv.net';
end;
'cage':begin
FishInfo.WhileFishing := @WhileFishingCage;
SetLength(FishInfo.EquipInventoryDTMs,1);
FishInfo.EquipInventoryDTMs[0] := 'inv.cage';
end;
'rod': begin
FishInfo.WhileFishing := @WhileFishingRod;
SetLength(FishInfo.EquipInventoryDTMs,2);
FishInfo.EquipInventoryDTMs[0] := 'inv.rod';
FishInfo.EquipInventoryDTMs[1] := 'inv.bait';
end;
'fly': begin
FishInfo.WhileFishing := @WhileFishingRod;
SetLength(FishInfo.EquipInventoryDTMs,2);
FishInfo.EquipInventoryDTMs[0] := 'inv.fly';
FishInfo.EquipInventoryDTMs[1] := 'inv.feather';
end;
end;
case lowercase(Players[CurrentPlayer].Strings[1]) of
'draynor': begin
WalkInfo.WalkToBank := @ToDraynorBank;
WalkInfo.WalkToLocation := @ToDraynorLocation;
end;
'edgeville': begin
WalkInfo.WalkToBank := @ToEdgevilleBank;
WalkInfo.WalkToLocation := @ToEdgevilleLocation;
end;
else begin
Players[CurrentPlayer].Booleans[0] := False;
ScriptWrite('Error 100: Unknown Location!');
end;
end;
end;
var
loadCount: Integer;
targetLoads: Integer;
begin
if SMART_World <> 0 then
SMART_Server := SMART_World;
SMART_members := false;
SMART_signed := true;
SetupSRL();
DeclarePlayers();
SetupScript();
while HavePlayers do
begin
SetupPlayer;
targetLoads := Players[CurrentPlayer].Integers[0] + random(2);
for loadCount:=0 to targetLoads do
begin
FishLoad;
if InvFull then
ClearLoadout
else begin
DeactivateCurrentPlayer;
Break;
end;
end;
Logout;
if CurrentPlayer = High(Players) then
CurrentPlayer := 0
else
Inc(CurrentPlayer);
end;
end.

marpis

2010-08-31 00:26:01

Wow. That looks like pure awesomeness :)
I love it when people use a lot of maths in scripts!

Tniffoc

2010-08-31 23:37:11

Quick Mention:

Functions as is as a Draynor/Edgeville powerfisher. I'm working on the fishing in Edgeville as sometimes, when not using reflection, it won't find a fishing spot and will attempt to click the other Fish symbol on the minimap, but won't find it. Working on a color fix to this. I know this is happening.