SRL Archive - SRL Archives

PickUpFishingEquip


Sir R. M8gic1an

2009-01-06 08:39:30


{*******************************************************************************
function PickUpFishingEquip(name:string):boolean;
by: Rasta Magician
Description: Finds and Picks up the fishing equipment on the ground
*******************************************************************************}
function PickUpFishingEquip(name:string):boolean;
var
TVFishingArray: TVariantArray;
x, y:integer;
begin
Result := False;
writeln('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 begin srl_warn('PickUpFishingEquip', 'Wrong input', warn_AllVersions); exit; end;
end;


FFLag(0);
if (FindObj(x, y, TVFishingArray[0], TVFishingArray[1], TVFishingArray[2])) then
begin
writeln('Found Equip');
Inc(RodsFound);
Result := True;
Mouse(x, y, 0, 0, True)
FFlag(0);
FTWait(5);
end else
writeln('Could not find equip');
end;

ok, i know there is one, but it is bitmap based and the bitmaps are outdated atm :) This is color based, but it is not 100%, i had to increase the wait in my own FindObj because it wouldn't get the UpText on time, the harpoon sometimes misclicks (it searches for the head, and sometimes ends up on the very edge of it).

but it worked pretty good :)

edit: Thanks to Zytex for suggesting and quickly explaining srl_warn();

~RM

TViYH

2009-01-06 14:49:20

Looks noice.

I'd recommend it for all fishing scripts. I hate leaving a char on overnight just to find it quit after 30 minutes due to a lost cage :(

EvilChicken!

2009-01-06 20:50:11

program SCARAssistant;
{.include SRL/SRL.scar}

function PickUpFishingEquip(Name: string): Boolean;
var
TVFishingArray: TVariantArray;
X, Y, A, M, curCTS: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
Result := False;
if not LoggedIn then Exit;
case Lowercase(Name) of
'harpoon': TVFishingArray := ['arpoon', 6645357, 14];
'cage': TVFishingArray := ['obster pot', 6974323, 7];
'fly', 'fly fishing', 'fly fishing rod': TVFishingArray := ['ly fishing', 872554, 13];
'rod', 'fishing rod': TVFishingArray := ['shing rod', 602951, 15];
'net': TVFishingArray := ['ing net', 1844525, 11];
else
begin
srl_Warn('PickUpFishingEquip', 'Invalid equipment name', warn_AllVersions);
Exit;
end;
end;

FFLag(0);
curCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, TVFishingArray[1], MSX1, MSY1, MSX2, MSY2, TVFishingArray[2]);
if Length(TPA) = 0 then
begin
ColorToleranceSpeed(curCTS);
Exit;
end;
ColorToleranceSpeed(1);
ATPA := TPAtoATPAEx(TPA, 15, 15);
M := High(ATPA);
for A := 0 to M do
if MiddleTPAEx(ATPA[A], X, Y) then
begin
MMouse(X, Y, 3, 3);
Wait(150 + Random(100));
if Pos(TVFishingArray[0], RS_GetUpText) > 0 then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Result := True;
ColorToleranceSpeed(curCTS);
Exit;
end;
end;
ColorToleranceSpeed(curCTS);
end;

begin
SetUpSRL;
ActivateClient;
Wait(350 + Random(500));
PickUpFishingEquip('harpoon');
end.

Base template, should work better than with findObj.
Though, if someone could get width, height and color count of each of the four objects, this function can be made quite a lot more precise using TPA length checks and splitting customized for target object.

P1nky

2009-01-06 20:54:44

Good Job i can use this as Tree finding func. (willows/oaks/trees)

just gotta edit it a bit =P