Sir R. M8gic1an
2010-06-10 16:59:57
In the function list.. No procedures appear. Is there any way to make them show there? (Or is this just a problem I'm having?)
~RM
~RM
2010-06-10 16:59:57
2010-06-10 17:00:45
2010-06-10 17:01:44
2010-06-10 17:06:02
From: nielsie95
Probably something in your code that's not compatible with the parser.
2010-06-10 17:12:26
2010-06-10 17:23:18
2010-06-10 17:32:23
{==============================================================================]
[==============================================================================]
[ RM Fisher 0.90 ]
[ By: Rasta Magician ]
[==============================================================================]
[ Features ]
[==============================================================================]
[ 1. Debug ]
[ 2. AntiRandoms ]
[ 3. AntiBan ]
[ 4. Multiplayer ]
[ 5. Resting ]
[ 6. Progress Report ]
[ 7. Local Control ]
[ 8. Responder ]
[ 9. Proggy To File ]
[ 10. Solves Whirlpool ]
[ 11. Picks up Fishing Equipment ]
[ 12. Auto-Detects fishing type ]
[ ------- Junior Member + ------- ]
[ 13. Banks at Draynor ]
[ 14. Withdraws new equipment if needed ]
[==============================================================================]
[ Description ]
[==============================================================================]
[ A Stable Fisher that can fish anywhere and any fish. It can also fish and ]
[ bank at Draynor. Draynor version is only availabe to JM+. ]
[ ]
[ ]
[==============================================================================]
[ How To Use ]
[==============================================================================]
[ Fill in DeclarePlayers, Place your players close to a Fishing spot, with ]
[ fishing equipment in inventory and jsut press play. ]
[ If Banking the fish start in bank WITH fish equip. It can do Net-fishing or ]
[ Rod-fishign as you preffer, as long as he starts with the equip in inventory ]
[ Also, have extra equip in inventory as it'll withdraw some if you lose it. ]
[ ]
[ To use local control press F12 while fishing. ]
[==============================================================================]
[ Credits ]
[==============================================================================]
[ SRL Team ]
[ Wizzup? - DebugTPA ]
[==============================================================================]
[ RM Fisher by Rasta Magician ]
[==============================================================================]
[==============================================================================}
{
average fish time
better whirpool handling
Local Control for SMART, through Debug Box
something wrong detecting starting to fish
}
program RMFisher;
{$DEFINE SMART }
{$DEFINE Reflection}
//{$DEFINE FORM }
{$IFDEF SMART }
{.include srl/srl/misc/Smart.scar}
{$ENDIF}
{.include srl/srl.scar}
{.include srl/srl/misc/worldswitcher.scar}
{.include srl/srl/skill/Fishing.scar}
{$IFDEF Reflection}
{.include SRL\SRL\Reflection\Reflection.scar}
{$ENDIF}
{$IFDEF FORM }
{.include srl/srl/misc/Users.scar}
{$ENDIF}
Const
WorkTime = (5*60*1000); //10 mins
RestTime = (3*60*1000); //3 mins
DropCrap = False; //dropping crap leaves more space per inv but the dropping is much slower
UseDebug = True;
UseResponder = True;
SaveProggyToFile = True;
SaveImages = True; //this is to help me improve the script
MaxImages = 200;
YourSRLID = ''; //your SRLID
YourSRLPass = ''; //your SRL Stats pass
MyScriptID = '1137'; // don't touch
ScriptName = 'RM Extreme Fisher'; // No Touchy!
Version = '1.60'; // No Touchy!
type
TAFT = record
FishyTime: integer;
TIA: TIntegerArray;
end;
var
Rested, Worked, Loads, Responses, FishSymbolColor,
//NetDTM, RodDTM, FlyDTM, CageDTM, HarpoonDTM,
IsFishCloseN, FoundWhirlPoolN, FoundFishSpotN, WhirlPools, RodsFound :integer;
ProggyStr, AvoidDir: string;
DirSet: Boolean;
TAverageFishTime: TAFT;
Function AverageIntegerArray(TIA: TIntegerArray): integer;
var
i, t :integer;
begin
t := High(TIA);
for i := 0 to t do
Result := Result + TIA[i];
Result := Round(Result / Length(TIA));
end;
// By Wizzup?
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
Var
Width, Height, ClientBMP, I: Integer;
xs, ys, xe, ye: Integer;
Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[i].X);
ys := Min(ys, Points[i].Y);
xe := Max(xe, Points[i].X);
ye := Max(ye, Points[i].Y);
End;
Width := xe - xs;
Height := ye - ys;
DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[i].X - xs, Points[i].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);
FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
{
Players Info
Integers[0] = Average Fish Time
Integers[1] = Fish Equipment Bitmap
}
//Declaring players
Procedure DeclarePlayers;
var i:integer;
begin
{$IFDEF FORM }
SRLPlayerForm(True, [], [], ['Location: Draynor, Power'], []);
writeln(' Players: '+IntToStr(HowManyPlayers) +'; Starting: '+Players[CurrentPlayer].Name);
for i:= 0 to High(Players) do
Players[i].Loc := lowercase(Players[i].Strings[0]);
exit;
{$ENDIF}
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name :='chaotic108';
Players[0].Pass :='oladani';
Players[0].Nick :='aoti';
Players[0].Active := true;
Players[0].BoxRewards := ['coin'];
Players[0].Loc := 'edgy'; //Power, Draynor
Players[0].Integers[0] := 40000; //average fish time (ms)
{
Players[1].Name := 'balahama02';
Players[1].Pass := 'marija';
Players[1].Nick := 'laha';
Players[1].Active := true;
Players[1].Loc := 'draynor';
Players[2].Name := 'etrangulo05';
Players[2].Pass := 'marija';
Players[2].Nick := 'angu';
Players[2].Active := true;
Players[2].Loc := 'draynor';
Players[3].Name := 'thescarnoob';
Players[3].Pass := 'marija';
Players[3].Nick := 'rno';
Players[3].Active := true;
Players[3].Loc := 'draynor';
Players[4].Name := 'filipoide o6';
Players[4].Pass := 'marija';
Players[4].Nick := 'ili';
Players[4].Active := True;
Players[4].Loc := 'draynor';
Players[5].Name := 'colaurite03';
Players[5].Pass := 'marija';
Players[5].Nick := 'auri';
Players[5].Active := True;
Players[5].Loc := 'draynor';
Players[6].Name := 'dulohva04';
Players[6].Pass := 'marija';
Players[6].Nick := 'lohv';
Players[6].Active := True;
Players[6].Loc := 'draynor';
Players[7].Name :='RMagician1';
Players[7].Pass :='marija';
Players[7].Nick :='aoti';
Players[7].Active := True;
Players[7].Loc := 'draynor'; //start loc
Players[8].Name :='mastaraym0nd';
Players[8].Pass :='marija';
Players[8].Nick :='aoti';
Players[8].Active := False;
Players[8].Loc := 'draynor'; //start loc
}
for i:= 0 to High(Players) do
Players[i].Loc := lowercase(Players[i].Loc);
writeln(' Players: '+IntToStr(HowManyPlayers) +'; Starting: '+Players[CurrentPlayer].Name);
end;
//Used for debugging and finding errors
Procedure RMDebug(s:string);
var name:string;
begin
if not UseDebug then exit;
try name := Players[CurrentPlayer].Name +' : '; except name:= '' end;
writeln(name+TheTime+' - '+s);
end;
Procedure RMFlag(int: integer);
begin
{$IFDEF Reflection}
if int = 5 then
begin
R_Flag;
exit;
end;
{$ENDIF}
FFlag(int);
end;
procedure Proggy;
var
JX2, i, i2:integer;
str: string;
begin
ClearReport;
SRLRandomsReport;
AddToReport('');
AddToReport('[====== '+Padr(ScriptName+' '+Version, 27)+' ======]');
AddToReport('[ By Rasta Magician ]');
AddToReport('[=========================================]');
AddToReport('[ ' + Padr('Written ' + (TheTime) + ' on ' + (TheDate(3)) + '.', 40) + ']')
AddToReport('[ '+ Padr(TimeRunning, 40)+']');
AddToReport('[ ' + Padr('Players: ' + IntToStr(PlayersActive)+ ' / ' + IntToStr(HowManyPlayers), 40) + ']');
AddToReport('[ ' + Padr('Current Player: ' + Players[CurrentPlayer].Nick, 40) + ']');
AddToReport('[ '+ Padr('Loads: '+IntToStr(Loads), 40)+']');
AddToReport('[ '+Padr('Rested: '+IntToStr(Rested), 40)+']');
if UseResponder then
AddToReport('[ '+Padr('Responded: '+IntToStr(Responses), 40)+']');
AddToReport('[================== RM ===================]');
ProggyStr := ProggyStr + chr(13) + ('[====== '+Padr(ScriptName+' '+Version, 27)+' ======]');
ProggyStr := ProggyStr + chr(13) + ('[ By Rasta Magician ]');
ProggyStr := ProggyStr + chr(13) + ('[=========================================]');
ProggyStr := ProggyStr + chr(13) + ('[ ' + Padr('Written ' + (TheTime) + ' on ' + (TheDate(3)) + '.', 40) + ']');
ProggyStr := ProggyStr + chr(13) + ('[ '+ Padr(TimeRunning, 40)+']');
ProggyStr := ProggyStr + chr(13) + ('[ ' + Padr('Players: ' + IntToStr(PlayersActive)+ ' / ' + IntToStr(HowManyPlayers), 40) + ']');
ProggyStr := ProggyStr + chr(13) + ('[ '+ Padr('Loads: '+IntToStr(Loads), 40)+']');
ProggyStr := ProggyStr + chr(13) + ('[ '+Padr('Rested: '+IntToStr(Rested), 40)+']');
if UseResponder then
ProggyStr := ProggyStr + chr(13) + ('[ '+Padr('Responded: '+IntToStr(Responses), 40)+']');
ProggyStr := ProggyStr + chr(13) + ('[================== RM ===================]');
AddToReport('[ P | A | L | Mins | Rand ' + Padl(']', 13));
AddToReport('[-----------------------------------------]');
ProggyStr := ProggyStr + chr(13) + ('[ P | A | L | Mins | Rand ' + Padl(']', 13));
ProggyStr := ProggyStr + chr(13) + ('[-----------------------------------------]');
for i:= 0 to HowManyPlayers - 1 do
begin
str := '[ ' + Padr(Players[i].Nick, 4) + ' | ';
if Players[i].Active then
str := str + 'T | '
else
str := str + 'F | ';
str := str + Padr(IntToStr(Players[i].Banked), 2) + ' | ' + Padr(IntToStr(Players[i].Worked), 5) +'| ';
str := str + Padr(Players[i].Rand, 16) + ' ]';
AddToReport(str);
ProggyStr := ProggyStr + chr(13) + str;
end;
str := ScriptName+' '+Version
i := length(str);
if (i mod 2) <> 0 then
i2 := 1;
AddToReport('[-----------------------------------------]');
AddToReport('[====== '+Padl('', 14 - Trunc(i/2)) + str + Padr('', 13 + i2 - Trunc(i/2))+' ======]');
AddToReport('[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]');
ProggyStr := ProggyStr + chr(13) + ('[-----------------------------------------]');
ProggyStr := ProggyStr + chr(13) + ('[====== '+Padl('', 14 - Trunc(i/2)) + str + Padr('', 13 + i2 - Trunc(i/2))+' ======]');
ProggyStr := ProggyStr + chr(13) + ('[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]');
AddToReport('');
//AddToReport('[/s_c_a_r]');
ProggyStr := ProggyStr + chr(13) + ('');
writeln(ProggyStr);
if SaveProggyToFile then
begin
JX2 := ReWriteFile((ScriptPath + ScriptName +' '+ Version + ' Proggy.txt'), False);
WriteFileString(JX2, ProggyStr);
CloseFile(JX2);
Writeln('Progress report saved to: ' + ScriptPath + ScriptName + ' ' + Version + ' Proggy.txt');
end;
Disguise(' A: '+IntToStr(PlayersActive) + '/' + IntToStr(HowManyPlayers) +
' Loads: ' + IntToStr(Loads));
end;
{$IFDEF SMART}
Procedure EasyRC;
var i:integer;
begin
if not IsFKeyDown(12) then exit;
LogOut;
Proggy;
writeln('Fresh proggie on your right');
writeln('');
writeln('--- MENU ---');
writeln('F9 --> Status');
writeln('F10 --> Reset All');
writeln('F11 --> manage players');
writeln('F1 --> Keep on autoing');
writeln('--- End Menu --- ');
writeln('');
wait(2000);
repeat
if IsFKeyDown(9) then //status
begin
for i:=0 to High(players) do
writeln(IntToStr(i)+': '+Players[i].Nick+' - '+BoolToStr(Players[i].Active));
end;
if IsFKeyDown(10) then //Reset All
begin
for i:= 0 to High(Players) do
Players[i].Active := true;
writeln('Reset all :) ');
end;
if IsFKeyDown(11) then // Manage Players
begin
end;
if IsFKeyDown(1) then break;
until(false)
writeln('Restarting to auto :)');
LoginPlayer;
end;
{$ELSE}
//local control, F12 to activate and then text. used to check on proggies and
//to reactivate players
//untested with smart, might not work
Procedure EasyRC;
var
i, h1, h2, x, y:integer;
s, str: string;
begin
if not LoggedIn then exit;
if IsFKeyDown(12) then
begin
RMDebug('Trying to use Easy RC');
h1 := GetClientWindowHandle;
GetMousePos(x, y);
SetClientPos(False);
Disguise('RM Easy RC');
if FindWindowTitlePart('RM Easy RC', false) then writeln('Using Easy RC');
h2 := GetClientWindowHandle;
SetOnTop(h1, False);
SetOnTop(h2, True);
SetClientWindowHandle(h2);
wait(100);
ActivateClient;
wait(100);
repeat
s:= ReadLn('What to do?'+chr(13)+'Status / Reset N / Reset All / Proggy / Exit');
lowercase(s);
if (s = 'exit') or (s = '') then break;
if s= 'status' then
begin
for i:= 0 to High(Players) do
if not Players[i].Active then str:= str+chr(13)+Players[i].Name;
readln('these are set to false: '+chr(13)+str+chr(13)+'Press ok');
end;
if s = 'proggy' then
begin
Readln(ProggyStr+chr(13)+'Press ok');
end;
if Pos('reset', s) > 0 then
begin
str := TrimLetters(Trim(s));
if str = '' then
begin
for i:= 0 to High(Players) do
Players[i].Active:= True;
ReadLn('All Players Active'+chr(13)+'Press ok');
end else
try begin
i:= StrToInt(str);
Players[i].Active := True;
Readln('activated player: '+str+chr(13)+'Press ok');
end except break end;
end;
until(false)
SetOnTop(h2, False);
SetOnTop(h1, True);
SetClientWindowHandle(h1);
ActivateClient;
MMouse(x, y, 2, 2);
wait(3000);
Disguise(' A: '+IntToStr(PlayersActive)+'/'+IntToStr(Length(Players))+' Loads: '+IntToStr(loads));
RMDebug('Done using Easy RC');
end;
end;
{$ENDIF}
type
MyChat = record
Chatter: TStringArray;
Said: TStringArray;
LastResponded: integer;
end;
var
Trigger: Array of Array[0..1] of TStringArray; //questions, could make more triggers... if i
Answers: Array of TStringArray; //find i need them
RMTalks: MyChat;
procedure SetupRespond;
var FishType:string;
begin
SetLength(RMTalks.Chatter, 8);
SetLength(RMTalks.Said, 8);
SetLength(Trigger, 5); //how many questions
SetLength(Answers, Length(Trigger));
//you can have as many trigger words and rows as you want
//you can have as many answers as you want
Trigger[0][0]:= ['fish', 'fishing', '><>', '<><']; // trigger words 1
Trigger[0][1]:= ['lvl', 'level', 'levl', 'lvel']; // trigger words 2
//Trigger[0][2]:= ['','','','','','']; // trigger words 3
Answers[0]:= [
'My Fishing Level is: '+IntToStr(Players[CurrentPlayer].Level[17]), //answer 1
'Fishing: '+IntToStr(Players[CurrentPlayer].Level[17]), //answer 2
IntToStr(Players[CurrentPlayer].Level[17])+' fishy lvl', //answer 3
'my fishy lvl is '+IntToStr(Players[CurrentPlayer].Level[17]) //answer 4
] ;
Trigger[1][0] := ['fish', '><>'];
Trigger[1][1] := ['which', 'what'];
case lowercase(Players[CurrentPlayer].Strings[0]) of
'harpoon': FishType := 'tuna';
'cage': FishType := 'lobby';
'fly': FishType := 'trout';
'rod': FishType := 'pike';
'net': FishType := 'shrimp';
end;
Answers[1] := [
'I''m fishing '+FishType,
FishType,
+'fishin: '+FishType
] ;
Trigger[2][0]:= ['place', 'train'];
Trigger[2][1]:= ['fishing', '><>', 'fish'];
Answers[2] := [
'Try Training fishing at Draynor',
'Draynor', 'Edgy', 'Al-Kharid', 'Karamja',
'Try Training fishing at Edgeville',
'Try Training fishing at Al-Kharid, close to bank',
'Try Training fishing at lumbridge'
];
{
Trigger[3][0]:= ['hi','hey', 'hello', 'sup?']; // trigger words 1
Trigger[3][1]:= ['hi','hey', 'hello', 'sup?']; // trigger words 2
Answers[3]:= ['hi','hey', 'hello', 'sup?', 'how do you do?']
}
Trigger[3][0] := [];
Trigger[3][1] := [];
Answers[3] := [];
end;
//from srl, modded ofr any line
function GetChatTextLine(var chat: string; line:integer): Boolean;
var
x, y: Integer;
textP: TPoint;
begin
if not LoggedIn then exit;
textP := TextCoords(line);
if findcolor(x, y, 16711680, textp.x, textp.y, textp.x + 200, textp.y + 14) then
begin
chat := LowerCase(Trim(GetTextAtEx(x - 3, textp.y - 2, 0, SmallChars, False,
False, -1, 1, 16711680, 60, False, tr_allChars)));
Result := True;
end;
end;
//from srl, modded for any line
function GetChatterLine(var name: string; line:integer): Boolean;
var
i: Integer;
textP: TPoint;
begin
if not LoggedIn then exit;
textP := TextCoords(line);
name := LowerCase(Trim(GetTextAtEx(textP.x - 2, textP.y - 2, 0, SmallChars, False, False, 0, 1,
0, 60, False, tr_allChars)))
i := Pos(':', name)
if (i <> 0) then
begin
Delete(name, i, i);
Result := True;
end;
end;
procedure RMRespond;
var
str: string;
i, h, t, k, triggered:integer;
TSA:TStringArray;
begin
if not LoggedIn then exit;
if (TimeFromMark(RMTalks.LastResponded) < 60000+Random(30000)) then exit;
SetLength(TSA, 8)
str:='';
TSA:=['', '', '', '', '', '', '', ''];
RMTalks.said := ['', '', '', '', '', '', '', ''];
triggered := 0;
// Getting text on all the lines
for i:= 7 DownTo 0 do
begin
GetChatterLine(RMTalks.Chatter[i], i+1);
if Pos(Lowercase(Players[CurrentPlayer].Nick), Lowercase(RMTalks.Chatter[i])) > 0 then
break; //if we already answered, it means we already checked further up.
GetChatTextLine(RMTalks.said[i], i+1);
TSA[i] := RMTalks.said[i];
end;
for i:=High(TSA) DownTo 0 do //all text lines
for h:= 0 to High(Trigger) do //questions
begin
triggered:= 0;
for t:=0 to High(Trigger[h]) do //How many triggers
for k:=0 to High(Trigger[h][t]) do //specific trigger
if Pos(Trigger[h][t][k], TSA[i]) > 0 then
begin
Inc(triggered);
if triggered >= 2 then
begin
Inc(Responses);
str:=(Answers[h][Random(Length(Answers[h]))]);
TypeSend(AddMistakes(str, RandomRange(10, 30)));
RMDebug('Question: '+Trigger[h][0][0]+ ' ' + Trigger[h][t][k]);
RMDebug('Responding: ' + str);
str := '';
MarkTime(RMTalks.LastResponded);
triggered := 0;
SetupRespond;
exit;
end; //end if
break;
end; //end if
//end k loop
end; //end h loop
//end of i loop
end;
//making sure we solve those annoying randoms :)
Function NoRandoms: boolean;
var
x, y:integer;
s:string;
begin
if not LoggedIn then exit;
Result := False;
GetMousePos(x, y);
if UseResponder then RMRespond;
if ClickToContinue then
begin
MMouse(x, y, 3, 3);
Result := True;
end;
if FindNormalRandoms then Result:=true;
if FindFight then
begin
//none of the run aways check for randoms....
repeat
case random(4) of
0: s:='n';
1: s:='w';
2: s:='s';
3: s:='e';
end;
if s <> AvoidDir then break;
until(false);
RMDebug('running to ' + s + ' and waiting for 8 - 10 s');
RunTo(s, True);
SleepAndMoveMouse(RandomRange(8000, 10000));
case s of
'n': s:= 'S';
's': s:= 'N';
'w': s:= 'E';
'e': s:= 'W';
end;
RMDebug('Returning to ' + s);
RunTo(s, True);
Result:=True;
NoRandoms;
end;
EasyRc;
end;
//Antiban, basically just picks up the mouse, increases mouse speed
//clicks a tab and resets everything back to the original.
//just to make sure we stay logged in.
procedure FastSwitchTabs;
var x, y, i, h:integer;
begin
if not LoggedIn then exit;
GetMousePos(x, y);
PickUpMouse;
IncEx(MouseSpeed, 10);
i := GetCurrentTab;
repeat
h := 1+Random(12);
until(h <> i)
GameTab(h);
wait(500+Random(500));
GameTab(i);
MMouse(x, y, 3, 3);
DecEx(MouseSpeed, 10);
end;
//will take "Time" + Random(1000) to complete the action, will return to original angle
// By Rasta Magician, heavily based on RandomMovement by Krazy_Meerkat
// will always move the compass around unlike in RandomMovement
procedure CompassMove(Time:Integer);
var s: string;
begin
repeat
case random(4) of
0: s:='n';
1: s:='w';
2: s:='s';
3: s:='e';
end;
if s <> AvoidDir then break;
until(false);
MakeCompass(s);
end;
//Random Right Click Return by Rasta Magician,
//Will right-click anywhere on he main map, choose "Cancel" and return the
//mouse to it's original position
procedure RRClickReturn;
var M:integer;
begin
if not LoggedIn then exit;
M := MouseSpeed;
MouseSpeed := MouseSpeed + Random(7);
ActivateClient;
Mouse(MSX1, MSY1, MSX2, MSY2, False);
wait(100 + Random(50));
ChooseOption('ancel');
wait(100 + Random(100));
MMouse(MSX1, MSY1, MMX2, MIY2);
MouseSpeed := M;
end;
Procedure AntiBan(percentage: integer);
begin
if not Loggedin then exit;
if random(100) <= percentage then
begin
NoRandoms;
case random(12) of
0, 1: begin FastSwitchTabs; RMDebug('Antiban: FastSwitchTabs'); end;
2, 3: begin CompassMove(RandomRange(1000, 2000)); RMDebug('Antiban: CompassMove'); end;
4, 5: begin RRClickReturn; RMDebug('Antiban: RRClickReturn'); end;
6, 7: begin SleepAndMoveMouse(1000); RMDebug('Antiban: SleepAndMoveMouse'); end;
8, 9: begin HoverSkill('random', false); RMDebug('Antiban: HoverSkill'); end;
10, 11: begin PickUpMouse; RMDebug('Antiban: PickUpMouse'); end;
end;
GameTab(4);
wait(200+Random(50));
NoRandoms;
end;
end;
procedure DoSomeFishing; forward;
Procedure WaitWhileFishing; forward;
Function StartFishing: boolean; forward;
//Just a few things it does when the script ends.
procedure ScriptTerminate;
begin
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + Round(TimeFromMark(Worked)/60000);
Proggy;
writeln('');
writeln('Thank for using my script, Rasta Magician');
writeln('Script stopped at ' + TheTime + ' ' + TheDate(3));
writeln('Please post the Progress Report');
Disguise('Game Over');
srl_FreeBitmaps;
end;
Function LocToBank:string;
begin
case lowercase(Players[CurrentPlayer].Loc) of
'draynor': Result:='db';
//'fally': Result:='feb';
'guild': Result := 'db';
'edgy': Result:= 'eb'
end;
end;
Function AutoColorBank: integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.31);
if not (FindColorsTolerance(arP, 5370353, MMX1, MMY1, MMX2, MMY2, 13)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
if (rs_OnMinimap(arP[i].x, arP[i].y)) then
begin
Result := arC[i];
Writeln('AutoColorBank = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
{$IFDEF WalkToPoint}
Function IsWalkable(TP : TPoint):boolean;
begin
Result := true;
end;
Function WalkToPoint(TP: TPoint): boolean;
var
x, y, l: integer;
TPA: TPointArray;
MyTP, NewTP, v: TPoint;
e: extended;
RW, ByX: boolean;
begin
while not (TileOnMM(TP)) do
begin
MyTP := GetMyPos;
v := Point(TP.x - MyTP.x, TP.y - MyTP.y);
e := Sqrt(Sqr(v.x / v.y));
RW := False;
NewTP := Point(0, 0);
if ( e > 1) then
ByX := true // |x| > |y| , we'll need to walk according to x
else
ByX := false; // |y| > |x| , we'll need to walk according to y
if ByX then //choosing the first coord
begin
if v.x > 0 then {--------|--------}
NewTP.x := MMX2 - 5 { - y | - y }
else { - x | + x }
NewTP.x := MMX1 + 5; { | }
{--------|--------}
if v.y > 0 then //getting the second coord -> { + y | + y }
NewTP.y := Round(MMCY + e*(MMY2 - 5 - MMCY)) { - x | + x }
else { | }
NewTP.y := Round(MMCY - e*(MMY2 - 5 - MMCY)); {--------|--------}
//(MMY2 - 5 - MMCY) is a length to walk;
// e * (MMY2 - 5 - MMCY) makes us walk in the vector's (v) direction
end else begin
if v.y > 0 then
NewTP.y := MMY2 -5
else
NewTP.y := MMY1 + 5;
if v.x > 0 then
NewTP.x := Round(MMCX + e*(MMX2 - 5 - MMCX))
else
NewTP.x := Round(MMCX - e*(MMX2 - 5 - MMCX));
end;
NewTP := MMToTile(NewTP);
if IsWalkable(NewTP) then
WalkToTile(NewTP, 3, 10)
else
RW := True;
if not RW then continue;
exit;
SetLength(TPA, 1);
for x:= MMX1 to MMX2 do
for y:= MMY1 to MMY2 do
begin
if not rs_OnMinimap(x, y) then Continue;
if not IsWalkable(MMToTile(Point(x, y))) then Continue;
l := Length(TPA);
SetLength(TPA, l +1)
TPA[l] := Point(x, y);
//Find the angle of NewTP
//do RadialWalkEx style
end;
end;
WalkToTile(TP, 1, 0);
end;
{$ENDIF}
//By ACA2
function AutoColorFishSymbol: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
if not LoggedIn then exit;
RMDebug('AutoColorFishSymbol: looking');
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.67, 1.30);
Result := 0;
FindColorsSpiralTolerance(MMCX, MMCY, arP, 15889937, MMX1, MMY1, MMX2, MMY2, 8);
if (Length(arP) = 0) then
begin
RMDebug('AutoColorFishSymbol: Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
if (rs_OnMinimap(arP[i].x, arP[i].y)) then
begin
ColorToRGB(arC[i], R, G, B);
if (R >= 8) and (R <= 45) and (G >= 35) and (G <= 207) and (B >= 209) and (B <= 256) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 12.35) and (X <= 41.17) and (Y >= 5.95) and (Y <= 51.91) and (Z >= 61.44) and (Z <= 102.45) then
begin
Result := arC[i];
RMDebug('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
RMDebug('AutoColor failed in finding the color.');
end;
Function FindFishSymbol(close:boolean; var TP: TPoint): boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, NewSymbolColor: integer;
begin
if not LoggedIn then exit;
Result := False;
RMDebug('looking for fish symbol');
FindSymbols(TPA, 'fish')
if Length(TPA) > 0 then
begin
RMDebug('found fish symbol')
NewSymbolColor := AutoColorFishSymbol;
if NewSymbolColor <> 0 then
FishSymbolColor := NewSymbolColor;
Result := True;
end else begin
RMDebug('no fish symbol, looking with autocolor');
FindColorsTolerance(TPA, FishSymbolColor, MMX1, MMY1, MMX2, MMY2, 5);
if Length(TPA) > 0 then
begin
Result := True;
ATPA := SplitTPA(TPA, 3);
for i:= 0 to High(ATPA) do
TPA[i] := MiddleTPA(ATPA[i]);
RMDebug('Found Symbol with AutoColor');
end else begin
RMDebug('Still Couldn''t find symbol');
exit;
end;
end;
SortTPAFrom(TPA, IntToPoint(MMCX, MMCY));
if close then
TP := TPA[0]
else
TP := TPA[High(TPA)];
end;
Function SymbolLocate(close: boolean): boolean;
var
TP:TPoint;
begin
RMDebug('Relocating to fish symbol');
Result := false;
if FindFishSymbol(close, TP) then
begin
Result := True;
if (close)and(InCircle(TP.x, TP.y, MMCX, MMCY, 12)) then
RMDebug('Already at Fish Symbol')
else begin
Mouse(TP.x, TP.y, 3, 3, true);
RMFlag(5);
wait(1000+Random(500));
end;
end;
end;
Function DraynorLocate(loc: string) : boolean;
var x, y, MyWaterColor, MyBankColor:integer;
begin
case loc of
'fish':
begin
Players[CurrentPlayer].Strings[2] := 'fish';
RunEnergy(25);
GameTab(4);
if FindSymbol(x, y, 'fishing spot') then
begin
writeln('found symbol');
Mouse(x, y, 2, 2, True);
end else begin
writeln('didn''t find symbol');
MyWaterColor := FindWaterColor;
RMDebug('watercolor: '+IntToStr(MyWaterColor));
if not RadialWalk(MyWaterColor, 200, 240, 50, 1, 1) then
if not RadialWalk(MyWaterColor, 180, 270, 50, 1, 1) then
begin
writeln('doing blind click');
Mouse(614, 130, 5, 5, True);
end;
end;
end;
'bank':
begin
RunEnergy(25);
Players[CurrentPlayer].Strings[2] := 'bank';
if not FindBank(loc) then
begin
if not FindSymbol(x, y, 'bank') then
begin
MyBankColor := AutoColorBank;
if MyBankColor = 0 then
Runto('n', true)
else
if FindColor(x, y, MyBankColor, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(x, y, 3, 3, true);
result := true;
exit;
end else
Runto('n', true);
end else begin
Mouse(x, y, 3, 3, true);
Result := true;
exit;
end;
if not FindBank(loc) then
begin
if not FindSymbol(x, y, 'bank') then
MyBankColor := AutoColorBank
else begin
Mouse(x, y, 3 ,3, true);
Result := true;
exit;
end;
end else begin
Result := true;
exit;
end;
if (MyBankColor = 0) then
begin
Result := false;
exit;
end;
if not FindColor(x, y, MyBankColor, MMX1, MMY1, MMX2, MMY2) then
begin
{
Players[CurrentPlayer].Rand := 'lost';
Players[CurrentPlayer].Active := false;
LogOut;
}
Result := False;
end else begin
Mouse(x, y, 3, 3, true);
result := true;
exit;
end;
end;
end;
end;
end;
Function GuildLocate(loc: string):boolean;
var
TP: TPoint;
Path : TPointArray;
i: integer;
begin
RMDebug('guild locate');
{$IFDEF Reflection}
Result := true;
case loc of
'bank':
begin
SetLength(Path, 4);
Path := [
Point(2586, 3419),
Point(2592, 3415),
Point(2598, 3410),
Point(2605, 3400)
];
repeat
for i:= 0 to High(Path) do
//begin
if TileOnMM(Path[i]) then
if WalkToTile(Path[i], 1, 5) then
begin
wait(200+Random(300));
break;
end;
//end;
case i of
0: begin RMDebug('TileOnMM'); exit; end;
1: RMDebug('bank door');
2: RMDebug('middleway');
3: RMDebug('under fishing spots');
4:
begin
RMDebug('character is lost!');
Players[CurrentPlayer].Rand := 'lost';
Players[CurrentPlayer].Active := false;
LogOut;
exit;
end;
end;
until(false)
end;
'fish':
begin
case Random(4) of
0: TP := Point(2602, 3424);
1: TP := Point(2602, 3420);
2: TP := Point(2607, 3415);
3: TP := Point(2604, 3412);
end;
SetLength(Path, 4);
Path := [
TP,
Point(2598, 3410),
Point(2605, 3400),
Point(2592, 3415)
];
repeat
for i:= 0 to High(Path) do
//begin
if TileOnMM(Path[i]) then
if WalkToTile(Path[i], 1, 5) then
begin
wait(200+Random(300));
break;
end;
//end;
case i of
0: begin RMDebug('TileOnMM'); exit; end;
1: RMDebug('middleway');
2: RMDebug('under fishing spots');
3: RMDebug('bank door');
4:
begin
RMDebug('character is lost!');
Players[CurrentPlayer].Rand := 'lost';
Players[CurrentPlayer].Active := false;
LogOut;
exit;
end;
end;
until(false)
end;
end;
exit;
{$ENDIF}
writeln('can not use fishing guild - reflection disabled');
end;
Function EdgyLocate(where: string): boolean;
var
Path: TPointArray;
i : integer;
begin
{$IFDEF Reflection}
Path := [
Point(3093, 3490),
Point(3101, 3480),
Point(3100, 3467),
Point(3087, 3464),
Point(3094, 3453),
Point(3098, 3440),
Point(3105, 3432)
];
if lowercase(where) = 'bank' then
begin
InvertTPA(Path);
SetRun(false);
end else
RunEnergy(25);
For i := 0 to High(Path) do
if TileOnMM(Path[i]) then
if not WalkToTile(Path[i], 1, 0) then
Result := false
else begin
FFlag(4);
end
else Result := false;
{$ELSE}
RMDebug('Edgeville fishing not done in color yet!');
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Rand := 'Color Not Done for Edgeville!';
Logout;
{$ENDIF}
end;
Function Relocate(loc: string):boolean;
var x, y, MyWaterColor, MyBankColor:integer;
begin
if not LoggedIn then exit;
if lowercase(Players[CurrentPlayer].loc) = 'power' then exit;
if Players[CurrentPlayer].Strings[2] = loc then exit;
RMDebug('going to: '+loc);
try MakeCompass('n');
RunEnergy(25);
Case Players[CurrentPlayer].loc of
'draynor': DraynorLocate(loc);
'guild': GuildLocate(loc);
'edgy': EdgyLocate(loc);
end;
finally
RMFlag(5);
wait(1000+Random(1000));
MakeCompass('n');
end;
end;
Function GetWaterLocation(TP: TPoint): string;
var
TBs: Array[1..4] of TBox;
TSA: TStringArray;
i, ang, place: integer;
begin
RMDebug('n wtaer location');
try
begin
if DirSet then exit;
Result := '';
TSA := ['n', 'e', 's', 'w'];
TBs[1] := IntToBox(MSCX-20, MSCY - 60, MSCX + 20, MSCY - 20);
TBs[2] := IntToBox(MSCX+20, MSCY - 20, MSCX + 60, MSCY + 20);
TBs[3] := IntToBox(MSCX-20, MSCY + 20, MSCX + 20, MSCY + 60);
TBs[4] := IntToBox(MSCX-60, MSCY - 20, MSCX - 20, MSCY + 20);
for i:= 1 to 4 do
begin
if IntInBox(TP.x, TP.y, TBs[i]) then
break;
end;
if i > 4 then
begin
RMDebug('something went wrong in getting water location');
exit;
end;
ang := Round(rs_GetCompassAngleDegrees);
case ang of
0..45: place := 0; // n
46..135: place := 1; // e
136..225: place := 2; // s
226..315: place := 3; // w
316..360: place := 0; // n
end;
RMDebug('place is: '+IntToStr(place));
case place of
0: TSA := ['n', 'e', 's', 'w'];
1: TSA := ['e', 's', 'w', 'n'];
2: TSA := ['s', 'w', 'n', 'e'];
3: TSA := ['w', 'n', 'e', 's'];
end;
RMDebug('water is at: '+TSA[i-1]);
Result := TSA[i-1];
AvoidDir := TSA[i-1];
DirSet := true;
end except wait(1); end;
RMDebug('out watr loc');
end;
{
function FindWhirlPoolXY(x, y:integer): Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
if not LoggedIn then exit;
Result := False;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.21, 1.58);
if not(FindColorsTolerance(arP, 13940675, x-25, y-25, x+25, y+25, 15)) then
begin
//Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPA(arP, 5);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) > Round(300*WhirlPoolAcc)) then
begin
Result := True;
RMDebug('Found Whirlpool! n: '+IntToStr(FoundWhirlpoolN));
RMDebug('Whirpool Points: '+IntToStr(Length(ararP[i])));
if SaveImages then
begin
if FoundWhirlPoolN >= MaxImages then FoundWhirlPoolN := 0
else Inc(FoundWhirlPoolN);
DebugTPA(ararP[i], 'RM_Fisher_Images - FoundWhirlPool'+IntToStr(FoundWhirlPoolN)) ;
end;
break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
}
function FoundWhirlPoolMS: Boolean;
begin
Result := True;
if not FindWhirlPoolXY(MSCX - 40, MSCY) then
if not FindWhirlPoolXY(MSCX + 40, MSCY) then
if not FindWhirlPoolXY(MSCX, MSCY - 40) then
if not FindWhirlPoolXY(MSCX, MSCY + 40) then
Result := False;
end;
procedure RMHandleWhirlPool;
var s: string;
begin
if not LoggedIn then exit;
if FoundWhirlPoolMS then
begin
RMDebug('Whirlpool found!');
RMDebug('Just gonna hang around, however if RM weren''t so lazy i''d probably look for another fishign spot!');
Inc(WhirlPools);
repeat
case random(4) of
0: s:= 'n';
1: s:= 'e';
2: s:= 's';
3: s:= 'w';
end;
until (s <> AvoidDir)
RunTo(s, false);
Wait(500+Random(500));
case s of
'n': s:= 's';
'e': s:= 'w';
's': s:= 'n';
'w': s:= 'e';
end;
Runto(s, false);
wait(400);
{
repeat
Antiban(50);
if (not (LoggedIn)) then Exit;
FTWait(50 + Random(2));
until not FoundWhirlPoolMS;
}
//could start fishing another spot instead of this
wait(Random(1000));
if not StartFishing then DoSomeFishing else WaitWhileFishing;
end;
end;
Function RMFindFishSpot: Boolean;
var
TPA: TPointArray;
TP : TPoint;
s: string;
begin
if not LoggedIN then exit;
if not FindFishSpotsTPA(TPA) then
begin
SymbolLocate(false);
exit;
end;
Result := FindFishSpot(TP.x, TP.y, lowercase(Players[CurrentPlayer].Strings[0]));
end;
Function DiscoverFishEquip: String;
var
i, Ix, Iy:integer;
begin
if not LoggedIn then exit;
Gametab(4);
RMDEbug('AutoDetecting equipment');
Result := '';
Gametab(4);
for i:= bmp_FishGear_Harpoon Downto bmp_FishGear_SmallNet do
begin
if FindBitmapToleranceIn(srl_GetBitmap(i), Ix, Iy, MIX1, MIY1, MIX2, MIY2, 10) then
begin
case i of
bmp_FishGear_SmallNet: Result := 'net';
bmp_FishGear_Rod : Result := 'rod';
bmp_FishGear_FlyRod : Result := 'fly';
bmp_FishGear_Cage : Result := 'cage';
bmp_FishGear_Harpoon : Result := 'harpoon';
end;
Players[CurrentPlayer].Integers[1] := srl_GetBitmap(i);
end;
if Result <> '' then break;
end;
if Result = '' then RMDebug('DiscoverFishEquip: Could not auto detect equip')
else RMDebug('fishing equip found: ' + Result);
end;
Function CheckEquip: Boolean;
var Ix, Iy, t, i:integer;
begin
if not LoggedIN then exit;
if FindNormalRandoms then exit;
for t := 0 to 2 do
begin
if Gametab(4) then break;
wait(1000+Random(500));
end;
if i >= 3 then
begin
RMDebug('couldnt get game tab');
Result := true;
CheckEquip;
exit;
end;
Result := FindBitmapToleranceIn(Players[CurrentPlayer].Integers[1], Ix, Iy, MIX1, MIY1, MIX2, MIY2, 10);
if not Result then RMDebug('CheckEquip: No fishing equipment found! - ');
end;
Function WithDrawEquip:boolean;
var x, y, i:integer;
begin
for i:= 0 to 3 do
begin
Result := true;
if not LoggedIn then exit;
if not BankScreen then exit;
Result := FindBitmapToleranceIn(Players[CurrentPlayer].Integers[1], x, y, MIX1, MIY1, MIX2, MIY2, 10);
if Result then
begin
Mouse(x, y, 3, 3, true);
wait(RandomRange(500, 1000));
end;
if CheckEquip then break;
end;
end;
Function GetNewEquip: boolean;
begin
Result := false;
RMDebug('Could not pick up equip; trying to withdraw from bank');
if Relocate('bank') then
begin
RMFlag(5);
wait(2000+Random(2000));
if OpenBank(LocToBank, true, false) then
if not WithDrawEquip then
begin
LogOut;
RMDebug('Player has no fishing equipment - Could not get it from bank');
exit;
end else begin
Relocate('fish');
Result := true;
exit;
end
else begin //if open bank
RMDebug('Could not open bank');
Relocate('fish');
end;
end else begin //if relocate('bank')
RMDebug('Could not get to bank');
Relocate('fish');
end;
end;
function PickUpFishingEquip(name:string):boolean;
var
TVFishingArray: TVariantArray;
x, y:integer;
begin
if not LoggedIn then exit;
if CheckEquip then exit;
if FindNormalRandoms then exit;
Result := False;
RMDebug('Looking for equip on the floor');
case lowercase(name) of
'harpoon': TVFishingArray := ['arpoon', 6645357, 14];
'cage': TVFishingArray := ['obster pot', 6974323, 7];
'fly', 'fly fishing': TVFishingArray := ['ly fishing', 872554, 13];
'rod', 'rod fishing': TVFishingArray := ['shing rod', 602951, 15];
'net': TVFishingArray := ['ing net', 1844525, 11];
else exit;
end;
RMFlag(5);
if (FindObj(x, y, TVFishingArray[0], TVFishingArray[1], TVFishingArray[2])) then
begin
RMDebug('Found Equip');
Inc(RodsFound);
Result := True;
Mouse(x, y, 0, 0, True)
RMFlag(5);
Wait(250);
end else
if Players[CurrentPlayer].loc <> 'power' then
Result := GetNewEquip
else begin
RMDebug('Could not find equip');
Players[CurrentPlayer].Rand := 'no equip';
end;
end;
function AreWeNearWater: Boolean;
var
arP: TPointArray;
tmpCTS, Time: Integer;
begin
Time := GetSystemTime;
Result := false;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.25);
if not(FindColorsTolerance(arP, 9403503, MSCX-60, MSCY-60, MSCX+60, MSCY+60, 5)) then
begin
RMDebug('We are not near water 1');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
if (Length(arP) >= 1000) then
Result := true;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if not Result then
begin
RMDebug('We are not near water 2');
Relocate('fish');
Exit;
end;
end;
function IsFishSpotClose: Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
TBs: Array[0..3] of TBox;
tmpCTS, i, j, arL, arL2, FindThisFish, WhirlPoolCheck: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
if not LoggedIn then exit;
Result := False;
if not AreWeNearWater then exit;
TBs[0] := IntToBox(MSCX-20, MSCY - 60, MSCX + 20, MSCY - 20);
TBs[1] := IntToBox(MSCX+20, MSCY - 20, MSCX + 60, MSCY + 20);
TBs[2] := IntToBox(MSCX-20, MSCY + 20, MSCX + 20, MSCY + 60);
TBs[3] := IntToBox(MSCX-60, MSCY - 20, MSCX - 20, MSCY + 20);
if (Round(rs_GetCompassAngleDegrees) mod 90) > 10 then
begin
case Round(rs_GetCompassAngleDegrees / 90) of
0: MakeCompass('w');
1: MakeCompass('n');
2: MakeCompass('e');
3: MakeCompass('s');
4: MakeCompass('w');
end;
RMDebug('IsFishSpotClose: re-adjusting compass ; angle: '+FloatToStr(rs_GetCompassAngleDegrees));
end;
MarkTime(FindThisFish);
MarkTime(WhirlPoolCheck);
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.12, 0.27);
repeat
if TimeFromMark(WhirlPoolCheck) > 500 then
begin
RMHandleWhirlPool;
exit;
end else
MarkTime(WhirlPoolCheck);
if TimeFromMark(FindThisFish) >= 3000 then break;
SetLength(ararP, 4);
for i:= 0 to 3 do
FindColorsTolerance(ararP[i], 11642528, TBs[i].x1, TBs[i].y1, TBs[i].x2, TBs[i].y2, 10);
try
arP := MergeATPA(ararP);
except
Continue;
end;
if Length(arP) <= 0 then
Continue;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 24.95) and (X <= 49.47) and (Y >= 26.29) and (Y <= 52.00) and (Z >= 35.63) and (Z <= 60.26) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPA(arAP, 35);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
//DebugTPA(ararP[i], 'RM_Fisher_Images - IsFishClose'+IntToStr(IsFishCloseN)) ;
if not DirSet then
begin
P := MiddleTPA(ararP[i]);
GetWaterLocation(P);
end;
Result := true;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
exit;
end;
until(TimeFromMark(FindThisFish) >= 3000);
RMDebug('no fish spot close');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
Function NextSpot: integer;
var
i:integer;
begin
if not LoggedIn then exit;
Result := 1;
for i:=1 to 28 do
if not ExistsItem(i) then
begin
Result:= i;
exit;
end;
end;
procedure DropFish;
var
i, x, y:integer;
TSA: TStringArray;
begin
if not LoggedIn then exit;
RMDebug('Dropping load');
if DropCrap then
TSA := ['eathe', 'bait', 'obster pot', 'arpoon', 'ly fish', 'ing rod', 'mall fish']
else
TSA := ['nchovies', 'erring', 'aw lobster', 'pike',
'almon', 'hrimps', 'ardine', 'wordfish', 'trout', 'tuna']
;
for i:= 1 to 28 do
begin
if (i mod 3) = 0 then NoRandoms;
MMouseItem(i);
wait(200 + random(50));
if DropCrap then
for x:= 0 to 3+Random(3) do
begin
if IsUpTextMultiCustom(TSA) then break;
if IsUpTextMultiCustom(['nchovies', 'erring', 'pike',
'almon', 'hrimps', 'ardine', 'wordfish', 'trout', 'tuna'])
then break;
wait(100);
end;
if IsUpTextMultiCustom(TSA) then
begin
if DropCrap then Continue;
GetMousePos(x, y);
Mouse(x, y, 2, 2, false);
wait(100+Random(50));
ChooseOption('Drop');
wait(RandomRange(50, 100));
end else begin
if not DropCrap then Continue;
GetMousePos(x, y);
Mouse(x, y, 2, 2, false);
wait(100+Random(50));
ChooseOption('Drop');
wait(RandomRange(50, 100));
end;
end;
Inc(Loads);
Inc(ReportVars[0]);
Inc(Players[CurrentPlayer].Banked);
RMDebug('Dropped a load');
Proggy;
end;
Procedure Bank;
var
i, h:integer;
Skip: boolean;
//BankFunction(bankname: string): array[0..1] of Function;
begin
if Players[CurrentPlayer].Loc = 'power' then
begin
DropFish;
exit;
end;
{
if Players[CurrentPlayer].loc = 'edgy' then
begin
BankFunction[0]('eb') := OpenBankFast('eb');
BankFunction[1]('eb') := OpenBankQuiet('eb');
end else begin
BankFunction[0](LocToBank) := @OpenBankQuiet(LocToBank);
BankFunction[1](LocToBank) := @OpenBankFast(LocToBank);
end;
}
Relocate('bank');
RMFlag(5);
wait(Random(100));
Inc(Loads);
Inc(ReportVars[0]);
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].loc = 'edgy' then
OpenBankFast('eb')
else
OpenBankQuiet(LocToBank);
for i:= 0 to 5 do
if BankScreen then break else wait(1000);
if not BankScreen then
begin
RMDebug('Attempting open bank fast');
if Players[CurrentPlayer].loc = 'edgy' then
skip := not OpenBankQuiet('eb')
else
skip := not OpenBankQuiet(LocToBank);
if skip then
begin
RMDebug('Couldn''t open bank, dropping load');
DropFish;
Relocate('fish');
exit;
end;
end;
skip := false;
if BankScreen then
begin
for i:=5 to 28 do
begin
if not ExistsItem(i) then Continue;
for h:= 1 to 5 do
begin
if IsUpTextMultiCustom(['eathe', 'bait', 'obster pot', 'arpoon', 'ly fish', 'ing rod', 'mall fish'])
then begin
Skip := True;
break;
end;
if IsUpTextMultiCustom(['nchovies', 'erring', 'pike','almon', 'hrimps', 'ardine', 'wordfish', 'trout', 'tuna']) then
break;
wait(200);
end;
if Skip then
begin
Skip := False;
Continue;
RMDebug('skipped');
end;
wait(random(100));
MouseItem(i, false);
wait(200+Random(100));
ChooseOption('it-All')
wait(500+random(300));
end;
if random(2) = 0 then CloseBank;
end;
RMDebug('Banked a load');
Proggy;
Relocate('fish');
wait(2000);
wait(1000+random(500));
end;
Function StartFishing: boolean;
var
i, x, y:integer;
s: string;
begin
if not LoggedIn then exit;
if InvFull then exit;
NoRandoms;
i:= 0;
Result := False;
if not CheckEquip then
begin
wait(1000 + Random(500));
if not PickUpFishingEquip(Players[CurrentPlayer].Strings[0]) then
begin
LogOut;
RMDebug('Player has no fishing equipment');
end;
end;
while not RMFindFishSpot do
begin
wait(1000);
NoRandoms;
inc(i);
if i > 2 then break;
end;
if i < 3 then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
RMDebug('Started Fishing');
Result := True;
end;
end;
Procedure WaitWhileFishing;
var
LastMove, LastAntiban, CheckSpot, SpotMark, FindFish, LastChecked, x, y: integer;
s: string;
begin
if not LoggedIn then exit;
MarkTime(FindFish);
MarkTime(LastMove);
RMFlag(5);
RMDebug('Getting to Fish Spot');
repeat
case lowercase(Players[CurrentPlayer].Strings[0]) of
'harpoon': s:= 'start harpooning';
'cage': s:= 'attempt to catch';
'fly': s:= 'attempt to catch';
'rod': s:= 'attempt to catch';
'net': s:= 'cast out your';
end;
if IsChatBoxTextAnyLine(s, clMessage) then break;
if TimeFromMark(FindFish) > 5000 then
begin
if FindTextTpa(0,2,MCX1,MCY1,MCX2,MCY2, 'have any feathers', NPCChars, Nothing) or
FindTextTpa(0,2,MCX1,MCY1,MCX2,MCY2, 'have any bait', NPCChars, Nothing) then
begin
RMDebug('Player is missing feathers / bait');
RMDebug('Logging Out');
LogOut;
exit;
end;
RMDebug('Getting to fish spot took too long');
if StartFishing then WaitWhileFishing else exit;
end;
until(false);
NoRandoms;
RMHandleWhirlpool;
RMDebug('Waiting while fishng');
CheckSpot := NextSpot;
MarkTime(SpotMark);
MarkTime(LastChecked);
MarkTime(FindFish);
MarkTime(LastAntiban);
repeat
if (TimeFromMark(Worked) >= (WorkTime + Random(3*60*1000))) then
begin
RMDebug('Wait while fising - Has served his time. Getting ready to switch');
exit;
end;
if not LoggedIn then
begin
RMDebug('Not Logged In!');
break;
end;
If TimeFromMark(LastChecked) > 500 then
begin
RMHandleWhirlpool;
if NoRandoms then
if not StartFishing then break else WaitWhileFishing;
MarkTime(LastChecked);
end;
if InvFull then
begin
Bank;
if not StartFishing then break else WaitWhileFishing;
end;
if ExistsItem(CheckSpot) then
begin
CheckSpot := NextSpot;
wait(50);
x := Length(TAverageFishTime.TIA);
SetLength(TAverageFishTime.TIA, x + 1);
TAverageFishTime.TIA[x] := TimeFromMark(SpotMark);
MarkTime(SpotMark);
end;
wait(450);
if TAverageFishTime.FishyTime + 10000 < 30000 then
y := 30000
else
y:= TAverageFishTime.FishyTime;
if (TimeFromMark(SpotMark) > y) then
begin
MarkTime(SpotMark);
wait(300);
RMDebug('WaitWhileFishing: Not Fishing...');
if StartFishing then WaitWhileFishing else break;
end;
if TimeFromMark(LastAntiban) > 1000+Random(1000) then
begin
MarkTime(LastAntiban);
Antiban(RandomRange(10, 20));
end;
if TimeFromMark(LastMove) > (20000 + Random(5000)) then
begin
AntiBan(100);
MarkTime(LastMove);
end;
if not CheckEquip then
begin
wait(1000 + Random(500));
if NoRandoms then
begin
if LoggedIn then
if StartFishing then
WaitWhileFishing
else
break
else
break
end else
if not PickUpFishingEquip(Players[CurrentPlayer].Strings[0]) then
begin
LogOut;
RMDebug(Players[CurrentPlayer].loc);
RMDebug('Player has no fishing equipment! - waitwhilefishing');
break;
end else
if StartFishing then WaitWhileFishing else break;
end;
if TimeFromMark(FindFish) > 1000 then
if not IsFishSpotClose then
begin
if StartFishing then
WaitWhileFishing
else break;
end else MarkTime(FindFish);
until(false)
end;
procedure DoSomeFishing; //only here while testing i think
var
TP: TPoint;
i, t, x, y: integer;
StartedFishing, FoundSymbol: boolean;
s: string;
begin
if not LoggedIn then exit;
if (TimeFromMark(Worked) >= WorkTime) then
begin
Relocate('bank');
exit;
end;
if not CheckEquip then
begin
wait(1000 + Random(500));
if not PickUpFishingEquip(Players[CurrentPlayer].Strings[0]) then
begin
LogOut;
Players[CurrentPlayer].Active := false;
RMDebug('Player has no fishing equipment');
exit;
end;
end;
if InvFull then Bank;
if Players[CurrentPlayer].loc <> 'power' then
Relocate('fish');
RMFlag(5);
wait(500+Random(1000));
for i:= 0 to 3 do
begin
FoundSymbol := SymbolLocate(i = 0);
if StartFishing then
begin
WaitWhileFishing;
exit;
end;
if not FoundSymbol then
begin
Relocate('bank');
Relocate('fish');
if not FindFishSymbol(false, TP) then
begin
Players[CurrentPlayer].Active := False;
Players[CurrentPlayer].Rand := 'lost';
Logout;
exit;
end;
end;
end;
end;
{$IFDEF SMART}
Procedure SetupSmart;
begin
SmartSetupEx(100, False, True, False);
Wait(5000);
SetTargetDC(SmartGetDC);
repeat
wait(100);
until(RSReady);
end;
{$ENDIF}
//Used to set up all the necessary things before the script starts running
Procedure SetupScript;
begin
ClearDebug;
ChangeReportWidth(250);
SetupSRL;
DeclarePlayers;
{$IFDEF SMART}
SetupSmart;
{$ENDIF}
SRLID := YourSRLID;
SRLPassword := YourSRLPass;
ScriptID := MyScriptID;
ActivateClient;
if Players[CurrentPlayer].loc = 'guild' then
SelectWorld(RandomWorld(True, AllowPVP))
else
SelectWorld(RandomWorld(False, AllowPVP));
LoginPlayer;
Disguise('RM Extreme Fisher '+Version+' !');
end;
procedure SwitchPlayers; forward;
//for prepqring the playe and making sure he has all the requirements
procedure SetupPlayer;
var s:string;
begin
if not LoggedIn then exit;
repeat
SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
Players[CurrentPlayer].Level[17] := GetSkillLevel('fishing');
RMDebug('Fishing Level: '+IntToStr(Players[CurrentPlayer].Level[17]));
SetAngle(true);
RMDebug('making compass N');
MakeCompass('n');
MarkTime(Worked);
s := DiscoverFishEquip;
if Players[CurrentPlayer].Strings[0] = '' then
Players[CurrentPlayer].Strings[0] := s;
if Players[CurrentPlayer].Strings[0] <> '' then
begin
if UseResponder then SetupRespond;
DirSet := False;
NoRandoms;
break;
end else begin
Players[CurrentPlayer].Rand := 'NoEquipOnStartup';
RMDebug('player had no equipment');
LogOut;
Players[CurrentPlayer].Active := false;
SwitchPlayers;
Continue;
end;
if s = '' then
if Players[CurrentPlayer].loc <> 'power' then //think for when i have 2+ locs
if not GetNewEquip then
begin
LogOut;
Players[CurrentPlayer].Rand := 'No Equip';
RMDebug('player has no equip');
end;
NoRandoms;
until(false)
TAverageFishTime.FishyTime := Players[CurrentPlayer].Integers[0];
SetLength(TAverageFishTime.TIA, 1);
TAverageFishTime.TIA[0] := TAverageFishTime.FishyTime;
if Players[CurrentPlayer].loc = 'draynor' then
begin
AvoidDir := 'w';
DirSet := True;
end;
if Players[CurrentPlayer].loc = 'edgy' then
begin
AvoidDir := 'e';
DirSet := true;
end;
RMDebug('Loc: '+Players[CurrentPlayer].Loc+'; Equip: '+Players[CurrentPlayer].Strings[0]+
'; Level: '+IntToStr(Players[CurrentPlayer].Level[17])+'; Fish Time: '+
IntToStr(Players[CurrentPlayer].Integers[0])+';');
end;
//switching palyers, or in case of jsut one player making it rest
// "not playing" for a while decreases the chance of getting a lot of randoms
procedure SwitchPlayers;
var t, MyNextPlayer:integer;
begin
if PlayersActive < 1 then exit;
MyNextPlayer := CurrentPlayer;
while Players[MyNextPlayer].Active = False do
begin
MyNextPlayer := (MyNextPlayer + 1) mod Length(Players);
if (AllPlayersInactive) then break;
end;
if (TimeFromMark(Worked) >= WorkTime)or(LoggedIn = False) then
begin
if PlayersActive > 1 then
begin
if (LoggedIn)and(Players[CurrentPlayer].loc <> 'power') then
Relocate('bank');
Players[CurrentPlayer].Active := LoggedIn;
Players[CurrentPlayer].Integers[0] := TAverageFishTime.FishyTime;
if (Players[CurrentPlayer].loc = 'guild')xor(Players[MyNextPlayer].Loc = 'guild') then
begin
LogOut;
if Players[MyNextPlayer].Loc = 'guild' then
SelectWorld(RandomWorld(True, AllowPVP))
else
SelectWorld(RandomWorld(False, AllowPVP))
end;
NextPlayer(Players[CurrentPlayer].Active);
RMDebug('Switching players, ' + Players[CurrentPlayer].Name +'going to ' + BoolToStr(LoggedIn));
Proggy;
end else begin
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked + Round(TimeFromMark(Worked)/60000);
Players[CurrentPlayer].Integers[0] := TAverageFishTime.FishyTime;
//eh? dunno what i was thinking, will have to check
if Players[CurrentPlayer].Active = false then //it means this player is false but there is one more
begin
Proggy;
LogOut;
NextPlayer(False);
SetupPlayer;
exit;
end;
LogOut;
Proggy;
RMDebug('resting....');
Disguise('(Rest) A: '+IntToStr(PlayersActive) + '/' + IntToStr(HowManyPlayers) +
' L: ' + IntToStr(Loads));
t := GetSystemTime;
while (GetSystemTime - t < RestTime) do
begin
wait(500);
Disguise('Resting for: '+msToTime(RestTime - (GetSystemTime - t), 2));
end;
Disguise(' A: '+IntToStr(PlayersActive) + '/' + IntToStr(HowManyPlayers) +
' Loads: ' + IntToStr(Loads));
ActivateClient;
LoginPlayer;
Inc(Rested);
MarkTime(Worked);
end;
SetupPlayer;
end;
end;
procedure CallAntiBan; //cus of srl procs
begin
Antiban(RandomRange(5, 15));
end;
begin
SetupScript;
SRL_Procs[srl_AntiBan] := @CallAntiBan;
SetupPlayer;
{$IFDEF Relfection}
SetupReflection;
{$EndIF}
repeat
if AllPlayersInactive then exit;
DoSomeFishing;
SwitchPlayers;
until(false)
end.2010-06-10 17:40:32
2010-06-10 17:41:53
From: nielsie95
Line 335: str := ScriptName+' '+Version;
You forgot a semicolon. I know it can be annoying, but this parser is based on a delphi parser.. :p
2010-06-10 21:49:16
From: Rasta Magician
Yup, Method found it as well and caught me on msn. Loving simba. All the features, looks and 'forced' standards.
~RM
2010-06-10 22:02:19
2010-06-10 22:38:36
From: noidea
Define forced standards please.