SRL Archive - Help and Support

Find Symbol Problem i think


Camaro'

2008-04-08 20:00:58

If FindSymbol(x, y, 'bank') Then

When i use that at draynor. It Never finds it. Im Right in front of the bank. I think the problem is that there is too many white dots over it. Is that the problem or is it my script?

drizzt

2008-04-08 21:06:41

its that there are too many white dots on it..try lowering symbolaccuracy, but not too low or it will find it when its not there

PriSoner

2008-04-08 23:35:54

You could log out and re-log in again that usually moves the icon (hopefully away from the dots) or you could do as me and use an AutoColour function as a backup if the normal function fails.. Remember you only have to get the colour from it once at the begining of the run and then just search for that colour.

Here's one I created using ACA2, feel free to use it..
{*******************************************************************************
function AutoBankSymb: Integer;
By: PriSoner using ACA2
Description: Finds colour of Bank Symbol.
*******************************************************************************}
function AutoBankSymb: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.45);

if not (FindColorsTolerance(arP, 3002600, MMX1, MMY1, MMX2, MMY2, 13)) then
begin
Writeln('Failed to find the bank symbol by AutoColour.');
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 >= 205) and (R <= 255) and (G >= 181) and (G <= 227) and (B >= 0) and (B <= 96) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 42.74) and (X <= 68.56) and (Y >= 46.79) and (Y <= 75.55) and (Z >= 7.39) and (Z <= 21.44) then
begin
Result := arC[i];
Break;
end;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then Writeln('AutoColor failed in finding the bank symbol color.');
end;

HyperSecret

2008-04-09 01:49:57

GetSymbolColor is a great function to use in this case…or make a dtm of the bankers works really well too

munk

2008-04-09 02:04:21

the bank symbols can float alot and even end up outside the bank, so id suggest the bankers dtm so you can end up right next to bank slots. But if you really wanna find the bank symbol…

function findBankSymbol(var rx, ry:integer):boolean;
var
i, col:integer;
Tcols:array of integer;
p:TpointArray;
begin
FindColorsTolerance(p,2720662,mmx1,mmy1,mmx2,mmy2,70);
for i:=0 to high(p) do
begin
col:=getColor(p[i].x,p[i].y);
Tcols:=[getColor(p[i].x-1,p[i].y),
getColor(p[i].x+1,p[i].y),
getColor(p[i].x,p[i].y-1),
getColor(p[i].x,p[i].y+1)];
if (inIntArray(Tcols,col+11825))or(inIntArray(Tcols,col+22158)) then
begin
rx:=p[i].x;
ry:=p[i].y;
result:=true;
exit;
end;
end;
writeln('Bank Symbol Not Found!');
end;
test that out :) Its accurate but a little slow :/

HyperSecret

2008-04-09 02:19:32

to make it alittle more accurate you could do


function findBankSymbol(var rx, ry:integer):boolean;
var
i, col, bc, tx, ty:integer;
Tcols:array of integer;
p:TpointArray;
begin
bc := GetSymbolColor(tx, ty, 'bank');
FindColorsTolerance(p,bc,mmx1,mmy1,mmx2,mmy2,70);
for i:=0 to high(p) do
begin
col:=getColor(p[i].x,p[i].y);
Tcols:=[getColor(p[i].x-1,p[i].y),
getColor(p[i].x+1,p[i].y),
getColor(p[i].x,p[i].y-1),
getColor(p[i].x,p[i].y+1)];
if (inIntArray(Tcols,col+11825))or(inIntArray(Tcols,col+22158)) then
begin
rx:=p[i].x;
ry:=p[i].y;
result:=true;
exit;
end;
end;
writeln('Bank Symbol Not Found!');
end;

getsymbolcolor to a variable and then searches for that color

munk

2008-04-09 02:42:38

From: HyperSecret
to make it alittle more accurate you could do


function findBankSymbol(var rx, ry:integer):boolean;
var
i, col, bc, tx, ty:integer;
Tcols:array of integer;
p:TpointArray;
begin
bc := GetSymbolColor(tx, ty, 'bank');
FindColorsTolerance(p,bc,mmx1,mmy1,mmx2,mmy2,70);
for i:=0 to high(p) do
begin
col:=getColor(p[i].x,p[i].y);
Tcols:=[getColor(p[i].x-1,p[i].y),
getColor(p[i].x+1,p[i].y),
getColor(p[i].x,p[i].y-1),
getColor(p[i].x,p[i].y+1)];
if (inIntArray(Tcols,col+11825))or(inIntArray(Tcols,col+22158)) then
begin
rx:=p[i].x;
ry:=p[i].y;
result:=true;
exit;
end;
end;
writeln('Bank Symbol Not Found!');
end;

getsymbolcolor to a variable and then searches for that color


yeah but I used ACA2 and alot of worldswitching to get that color/tol, and what if its covered, getSymbolColor wont work. I guess with like a default setting it could work real good. But you should test it :D try dropping buncha stuff on the bank symbol and seeing if it finds it:D

P.S. im gonna catch you in stats(h)

Camaro'

2008-04-09 07:30:04

From: munk
yeah but I used ACA2 and alot of worldswitching to get that color/tol, and what if its covered, getSymbolColor wont work. I guess with like a default setting it could work real good. But you should test it :D try dropping buncha stuff on the bank symbol and seeing if it finds it:D

P.S. im gonna catch you in stats(h)


Every one Thanks for the help. I switched worlds and it was the white dots. Im gonna use make it go for the bank dtm. If it doesnt find the bank dtm go with Munks procedure.. Thankyou guys.

nielsie95

2008-04-09 13:20:12

Or you could just lower the SymbolAccuracy and keep using SRL's function ;)

SKy Scripter

2008-04-09 15:27:53

From: munk
the bank symbols can float alot and even end up outside the bank, so id suggest the bankers dtm so you can end up right next to bank slots. But if you really wanna find the bank symbol…

function findBankSymbol(var rx, ry:integer):boolean;
var
i, col:integer;
Tcols:array of integer;
p:TpointArray;
begin
FindColorsTolerance(p,2720662,mmx1,mmy1,mmx2,mmy2,70);
for i:=0 to high(p) do
begin
col:=getColor(p[i].x,p[i].y);
Tcols:=[getColor(p[i].x-1,p[i].y),
getColor(p[i].x+1,p[i].y),
getColor(p[i].x,p[i].y-1),
getColor(p[i].x,p[i].y+1)];
if (inIntArray(Tcols,col+11825))or(inIntArray(Tcols,col+22158)) then
begin
rx:=p[i].x;
ry:=p[i].y;
result:=true;
exit;
end;
end;
writeln('Bank Symbol Not Found!');
end;
test that out :) Its accurate but a little slow :/



How long does that take?


The new FindSymbol should only take 50.msc and should be very accurate.
But the Old one took me about 400.msc :)

Camaro'

2008-04-09 15:57:58

From: SKy Scripter
How long does that take?


The new FindSymbol should only take 50.msc and should be very accurate.
But the Old one took me about 400.msc :)



Well in my particular script, 50 ms or 600 ms isnt a factor lol. I just need effectiveness.

SKy Scripter

2008-04-09 16:01:41

From: cnr sport
Well in my particular script, 50 ms or 600 ms isnt a factor lol. I just need effectiveness.


Well, it's not only the time, but the accuracy is probably 10 times better.

The Claw

2008-04-19 12:34:30

very big problem use a dtm of the bank on minimap bro - steal from wizzups netter like i did