SRL Archive - First Scripts

DraynorNetter


Rally

2012-01-23 15:37:16

Hello, first attempt to make a stable script.
It's a basic draynor fisher for shrimp/anchovies.

Setup:
Have net in your toolbelt
Start near fishspots
Fill in your time for checking if your still fishing in declare players, it's default 20 seconds. It will check for inventory change.


Questions
I would want another detection other than the fishtimer. I tried pixelshift but seems not to be so stable for example if you change angle. Suggestions?

The scripts eat more memory the whole time, how to reduce this?


program DraynorNetter;
{$DEFINE SMART}
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
Players[0].Integers[0] := 20000; // Fish timer
end;

var
FishXpHour, FishesInHour, LoadsInHour, FishXp, Caught, Loads, Shrimp, Anchovie, Shrimp_Caught, Anchovie_Caught :integer;
FishPath: Array of Integer;
BankPath: Array of Integer;
Location, WBank: String;

procedure loadDTM;
begin
Shrimp := DTMFromString('mWAAAAHicY2FgYJjFxMCwAojnA/EUILZjZGAwBWI3ILYG4rooN4Yp7Q0M3fUVYPo/UA8/EmZEwyAAAC1rCoA=');
Anchovie := DTMFromString('mWAAAAHicY2FgYDjBxMCwD4gvAfEpILZlZGCwBmIzIHYF4tDQJIbk5GKGpKR0hsSkQob/QD38SJgRDYMAACzcCfo=');
SetArrayLength(FishPath, 1);
SetArrayLength(BankPath, 1);
FishPath[0] := DTMFromString('mQwAAAHicY2ZgYKhmYmDIB+JSIL4A5F8E4stAXJJryeC46zMDu919hv9APj8UMyJhIAAAcJEJKQ==');
BankPath[0] := DTMFromString('mbQAAAHicY2VgYNjAxMCwD4r7gHgSEMcBxUuAuAaIZwNxHRC7uhsx7NpWBMaaGT8YDFLEGf4DxfnRMCMWDAYArmsNuQ==');
end;

Procedure Antiban; // credits to YoHoJo for this antiban
Begin
Case Random(200) Of
0:
begin
writeln('Antiban ... Hover fishing');
GameTab(tab_Stats) HoverSkill('Fishing', False);
Wait(500 + Random(500));
GameTab(tab_Inv);
end;
1:
begin
writeln('Antiban ... Examine inventory');
GameTab(tab_Inv);
ExamineInv;
end;
2:
begin
writeln('Antiban ... Sleep and move mouse');
SleepAndMoveMouse(4000 + Random(500));
end;
3:
begin
writeln('Antiban ... Hover random skill');
HoverSkill('random', False);
Wait(1000 + Random(500));
GameTab(tab_Inv);
end;
4:
begin
writeln('Antiban ... Look at stats');
GameTab(Tab_Stats);
Wait(3000 + Random(1500));
GameTab(tab_Inv);
end;
5:
begin
writeln('Antiban ... Pickup mouse');
PickUpMouse;
end;
6:
begin
writeln('Antiban ... Bored human');
BoredHuman;
end;

End;
End;
function WalkDTMPathEx(DTM: Array of Integer; PathStart: Integer; PathEnd: Integer): boolean; // Credits to maigel for this function
var
i: Integer;
x, y: Integer;
aFound: Extended;
timer: Integer;
begin
Result := True;
for i := PathStart to PathEnd do
begin
RunEnergy(RandomRange(40,50));
if FindDTMRotated(DTM[i], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
if (i <> High(DTM)) then
begin
MarkTime(timer);
repeat
Wait(50 + Random(25));
until FindDTMRotated(DTM[i+1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(timer) > 20000);
if(TimeFromMark(timer) > 20000) then
begin
Writeln('DTM ' + IntToStr(i + 1) + ' not found');
Result := False;
Break;
end;
end;
end
else
begin
Writeln('DTM ' + IntToStr(i) + ' not found');
Result := False;
Break;
end;
end;
Flag;
end;

function WalkDTMPath(DTM: Array of Integer): boolean;
begin
Result := WalkDTMPathEx(DTM, 0, High(DTM));
end;

procedure FreeDTMArray(DTM: Array of Integer);
var
i: Integer;
begin
for i := 0 to High(DTM) do
begin
FreeDTM(DTM[i])
end;
end;

procedure FreeDTMs;
begin
FreeDTMArray(FishPath);
FreeDTMArray(BankPath);
FreeDTM(Shrimp)
FreeDTM(Anchovie);
end;

function Fishing: boolean;
var
prevCount, curCount, Timer: Integer;
begin
MarkTime(Timer);
prevCount := InvCount;
repeat
if not LoggedIn then
Exit;

curCount := InvCount;
if not (curCount = prevCount) then
begin
MarkTime(Timer);
prevCount := curCount;
end;

if (TimeFromMark(Timer) >= Players[CurrentPlayer].Integers[0]) and (prevCount = curCount) then
begin
Location:= 'fish';
Exit;
end;
Antiban;
FindNormalRandoms;
Sleep(RandomRange(1000,1200));
until (InvCount = 28);
Result := True;
end;

function StartFish: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
FindColorsTolerance(tpa, 10721426, MSX1, MSY1, MSX2, MSY2, 6);
atpa := TPAToATPAEx(tpa, 15, 15);
for i := 0 to High(atpa) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
if WaitUpTextMulti(['Net', 'et'], 1200) then
begin
ClickMouse2(false);
WaitOption('et', 1200);
Result := True;
Exit;
end;
end;
Wait(200 + Random(200));
Inc(tries);
until tries > 10;
Result := False;
end;

function Bank: boolean;
var
Sp, Ae, tries: Integer;
begin
tries := 1;
repeat
if (InvCount)< 28 then
begin
Result := not InvFull;
exit;
end;
if (not(BankScreen)) then
begin
if (not(OpenBankFast(WBank))) then
begin
WriteLn('Error: Cant open bank');
Wait(200 + Random(300));
end;
end;
if BankScreen then
begin
Wait(200 + Random(300));
GameTab(tab_Inv);
if (InvFull) then
begin
SP := CountItems('dtm', Shrimp, []);
AE := CountItems('dtm', Anchovie, []);
IncEx(Shrimp_Caught, SP);
IncEx(Anchovie_Caught, AE);
end;
if (not(InvEmpty)) then
begin
DepositAll;
inc(Loads);
Result := not InvFull;
exit;
end;
end;
Wait(200 + Random(200));
Inc(tries);
until tries > 10;
Result := False;
end;

Procedure Report;
begin
Caught := Loads * 28;
FishXp:= ((Shrimp_Caught*10)+(Anchovie_Caught*40));
LoadsInHour := Round((Loads * 3600) / (GetTimeRunning / 1000));
FishesInHour := Round((Caught * 3600) / (GetTimeRunning / 1000));
FishXpHour := Round((FishXp * 3600) / (GetTimeRunning / 1000));
WriteLn('========================================================');
WriteLn('Time Running: '+TimeRunning);
Writeln('Shrimp Caught: ' + IntToStr(Shrimp_Caught));
Writeln('Anchovie Caught: ' + IntToStr(Anchovie_Caught));
Writeln('Fishing Xp Gained: ' + IntToStr(FishXp));
Writeln('Thats: ' + IntToStr(FishXpHour) + ' Xp per hour');
WriteLn('========================================================');
end;

procedure SmartSet;
begin
Smart_Server := 1;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
end;

procedure SettingUp;
begin
loadDTM;
AddOnTerminate('Ending');
MouseSpeed := 18;
MakeCompass('n');
SetAngle(SRL_ANGLE_HIGH);
GameTab(tab_Inv);
WBank:= 'db';
Location := 'fish';
end;

procedure Ending;
begin
FreeDTMs;
Logout;
Terminatescript;
end;

begin
SmartSet;
ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
SettingUp;

repeat
FindNormalRandoms;
Case Location of
'bank':if Bank then
begin
Location:= 'to spot';
Report;
end;
'to spot': if walkDTMPath(FishPath) then
Location:= 'fish';
'fish': if StartFish then
Location:= 'fishing';
'fishing': if fishing then
Location:= 'to bank';
'to bank': if walkDTMPath(BankPath) then
Location:= 'bank';
end;
Sleep(RandomRange(500,800));
until (False);
Ending;
end.


Credits to YoHoJo,Maigel for some(most:)) functions (might be slighty edited)

kingsleyeng

2012-02-27 14:11:35

direct download please (:

brother287

2012-03-10 11:47:06

You should have a dropping option, i didnt see one. Although i prefer banking over it.

brother287

2012-03-10 11:54:29

Also iv noticed that there a sleep and move mouse? which seems to idle for a long time. doesnt seem efficient