View Full Version : TPA query
cadet54
06-06-2012, 11:04 AM
Hi there I have been working on a basic guild fisher, my first version used FindObjTPA, I want to try and use something a little more advanced to find the fishing spots, Im using FindColorsSpiralTolerance, It took a little while to get the right colours but I have them right now.
My question to you, am I going the right way about adding TPA's into the script is there a better way of finding fishing spots quicker and more reliably?
Function StartFishing: Boolean;
var
MyTPA : TPointArray;
MyPoint : TPoint;
CTS, x, y, i : Integer;
begin
x := MSCx;
y := MSCy;
CTS := GetColorToleranceSpeed;
count := 1
If Not CTS = 2 Then ColorToleranceSpeed(2);
Writeln('Searching');
FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSx1, MSy1, MSx2, MSy2, 5);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSX1, MSY1, MSX2, MSY2, 5);
for i := 0 to High(MyTPA) do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['age', 'Fishing', 'Spot'])) then
begin
Writeln('Spot Found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('age');
Wait(500+random(250));
Result := True
Exit;
end;
Wait(350+random(350));
end;
end;
You're using CTS2, but not using Hue/Sat modifiers.
Read a Autocoloring guide to figure out what they are, makes it so much more accurate.
cadet54
06-06-2012, 11:57 AM
So your find bank function could be used to find fishing spots I guess just need to change a few things about.
CephaXz
06-06-2012, 12:01 PM
Can be use to find just about anything, and if you use it with hue and sat mod, it will find objects even more accurate.
cadet54
06-06-2012, 12:03 PM
Nice one thanks for the tutorial NKN and thanks for the advice CephaXz
Runaway
06-06-2012, 04:21 PM
Definitely a good idea to use TPAs for fishing; I recommend you use an ATPA as well though. It will make it much more efficient. Try something like this:
FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSX1, MSY1, MSX2, MSY2, 5);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSX1, MSY1, MSX2, MSY2, 5); // Maybe increase the tol a little if the first search failed?
MyATPA := SplitTPAEx(MyTPA, 20, 20);
for i := 0 to High(MyATPA) do
begin
MyPoint := MiddleTPA(MyATPA[i])
You have a great start though :) You might also want to add hue/sat mods if you're going to use CTS2.
Brandon
06-06-2012, 04:39 PM
http://villavu.com/forum/showthread.php?t=70488
Don't know if it still works but it's worth a shot.
cadet54
06-07-2012, 07:55 AM
This what I have after the advice I have gotten from you guys, I don't think there is much more I can add accept from fail safes I guess, any words of wisdom are welcome. :)
Function StartFishing: Boolean;
var
MyTPA : TPointArray;
MyATPA : T2DPointArray;
MyPoint : TPoint;
CTS, x, y, i : Integer;
begin
x := MSCx;
y := MSCy;
CTS := GetColorToleranceSpeed;
If Not CTS = 2 Then ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.50,0.90);
Writeln('Searching');
FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSX1, MSY1, MSX2, MSY2, 5);
if Length(MyTPA) = 0 then FindColorsSpiralTolerance(x, y, MyTPA, 11248540, MSX1, MSY1, MSX2, MSY2, 5);
MyATPA := SplitTPAEx(MyTPA, 20, 20);
for i := 0 to High(MyATPA) do
begin
MyPoint := MiddleTPA(MyATPA[i])
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUptextMultiCustom(['fish', 'cage', 'spot', 'harpoon'])) then
begin
Writeln('Spot Found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
ChooseOption('age');
Wait(500+random(250));
Result := True
Exit;
end;
Wait(350+random(350));
end;
end;
cadet54
06-07-2012, 10:11 AM
I have tried a few differen variations but I cant seem to get this TPA stuff to work will just stick with what I got I guess.
Function StartFishing: Boolean;
begin
if (TypeOfFish = 'Lobster') then //Lobster
if not findnormalrandoms then
begin
count := 1
f := 0
repeat
inc(count);
x := MSCX;
y := MSCY;
Writeln('Searching');
Wait(randomrange(300,500));
If (FindObjTPA(x, y, 11379098, 10, 1, 20, 20, 2,['Cage'])) then
begin
writeln('Found possible spot');
Mouse(x, y, 4, 4, False);
If (WaitOption('Cage', 2000)) then
begin
writeln('Found spot');
result := true
Break;
end;
end;
until((Count>4) or (true));
If (count>4) then
begin
result := false
end;
end else
begin
Writeln('Found random');
Logout;
TerminateScript;
end else //End Lobster
begin //Shark
if not findnormalrandoms then
begin
count := 1
f := 0
repeat
inc(count);
x := MSCX;
y := MSCY;
Writeln('Searching');
Wait(randomrange(300,500));
If (FindObjTPA(x, y, 11379098, 10, 1, 20, 20, 2,['Net'])) then
begin
writeln('Found possible spot');
Mouse(x, y, 4, 4, False);
If (WaitOption('Harpoon', 2000)) then
begin
writeln('Found spot');
result := true
Break;
end;
end;
until((Count>4) or (true));
If (count>4) then
begin
result := false
end;
end else
begin
Writeln('Found random');
Logout;
TerminateScript;
end //End Shark
end;
end;
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.