SRL Archive - OSR Help

How do I find an image by using a few colors I chose that must be on that image?


wayne1210

2008-04-14 19:48:17

How do I find an image by using a few colors I chose that must be on that image?

Please help me =D

and how do I make it tell me at what coordinate on my screen is the image?

Runescapian321

2008-04-14 20:01:15

You mean like



//Finds a color and clicks on it
program test;
{.include SRL\SRL.scar}

const

color = 6666; //color
tol = 66; //tolerance

var x,y,xs,ys,xe,ye: Integer;

procedure findimage;
begin
if Findcolortolerance(x,y,color,xs,ys,xe,ye,tol) then
begin
mouse(x,y,0,0,true);
end;
end;

begin
SetupSRL;
findimage;
end.

EDIT: Oh, wait you want to click on a single image of a bunch of colors? You might need to make a DTM for that.

In which case it would be

program test;
{.include SRL\SRL.scar}

var x,y: Integer;

procedure findimage;
begin

image := DTMFromString({dtm here});

if FindDTM(image,x,y,x1,y1,x2,y2);
begin
mouse(x,y,0,0,true);
end;
end;

begin
SetupSRL;
findimage;
end.

wayne1210

2008-04-14 20:41:27

can you explain how i would use these more indepth?

i m getting the error "Duplicate identifier 'x' in script "
in the first script at line 10, and in the second script at line 4

Runescapian321

2008-04-14 20:57:12

Are you sure you have the latest revision? Look in my sig, and read the tut on preparing to auto. If you want to find a whole image, read this tut - http://www.villavu.com/forum/showthread.php?t=564?t=663&highlight=yohojo

Then implement a dtm into the second script. If you need help putting it in, just post the dtm and I'll help.

wayne1210

2008-04-14 21:04:42

im not really trying to make an autoer,
here's what im trying to make:

I have a small image, and I want SCAR to find another
image that is identical to the original image, and I plan
to do that by having SCAR use a few colors I have chose
from the original image and search through a bunch of other
images to find the same colors. So I am assuming that if two
images have the same colors, they are the same image.

i don't want to make it into find bitmap though, just use colors
colors, they are the same image.

King of the Nites

2008-04-14 21:07:05

Read some Tutorials i'll post a great one for you to use.

http://www.villavu.com/forum/showthread.php?t=28436
Here is Naum's great static arrays, which are good for some of those kinds of stuffs.

http://www.villavu.com/forum/showthread.php?t=564
Yohojo's DTM Tut it is really detailed. It could find that object exactly

Runescapian321

2008-04-14 21:09:32

Yeah, it's kinda hard to do that with colors alone, you have to have some sort of pattern, which is why I recommend DTMs. It'll take like 2 minutes to make. all it is is basically opening the DTM editor, clicking a bunch of points on your image, then putting it into a script, which I have already made for you.

wayne1210

2008-04-14 21:12:26

can i find an image using DTM if my original image is only 1/10th
of the image im looking for?

here's an example of the original image and the image i would be looking for:

i have:


i want to match it with:


Runescapian321

2008-04-14 21:19:38

Yeah, probably. Just don't zoom in or anything, make the DTM from the original picture.

EDIT: But with THAT big a color difference, you could just use color lol. Unless there's a certain part of it you want to click on.

EDIT: 998 posts, the time is coming….

wayne1210

2008-04-14 21:23:30

i don't want it to click anything, just tell me at what coordinate the founded-image in on my screen

King of the Nites

2008-04-14 21:28:48

Well if I am on the same page as you then I am pretty sure you could just use the scar colorpicker. The color picker gives you the color of the image and the x and y coordinates.

wayne1210

2008-04-14 21:35:33

hmm no..

let's try again..

I have a few colors and i know what they are, all i want is for scar
to tell me where i can find those color on my computer screen :)

it shuld be very simple right?

Lee Lok Hin

2008-04-15 04:59:16

FindObjTPA(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: tstringarray): Boolean;

Oh, btw, just put -1 for "cts"

Returns true if it finds a user set amount(mincount) of the same colour(color)with tolerance inside a square specified by objheight and objwidth..

Like, if in this square

*Put square here*

there are 5 purples, and i put 6 for mincount, then it wont return true

You could just copy the whole findobjtpa function into your script, then remove the uptext bit.

Or, personally, i just recommend DDTMs.

Naum

2008-04-15 05:05:27

Cool my tut is posted here, You need to make a bitmap of it otherwise it will find any color.

Here:

untitled := BitmapFromString(149, 150, 'beNrt3aFKg1EYgOELGK' +
'Z5A7ooghcglt2CSWQm08Cy5h8U1GDSIBimwSID24IgOFBsmmRFULD' +
'ZDBazt3C+Azv4bw+8N3DOEw/fd7qj14uv9B5PPqIND8fRrqvnUP3e' +
'U7TT7iha/+Ah1Fl1H2134yYaPnz48OHDhw8fPnz48OHDhw8fPnz48' +
'OHDhw8fPnz4Ujrevgu13xkWCB8+fPjw4cOHDx8+fPjw4cOHDx8+fP' +
'jw4cOHDx8+fPXle7v6Tg8fPnz48OHDhw8fPnz48OHDhw8fPnz48OH' +
'Dhw8fPnz48OErzDdp7jxxfPjw4cOHDx8+fPjw4cOHDx8+fPjw4cOH' +
'Dx8+fDPO9z74TW9QfUY733mJFr2oKPc0iePDhw8fPnz48OHDhw8fP' +
'nz48OHDhw8fPnz48OHDh6++fLdHP+ll8F32xtGi3BmnLiMeLePvWn' +
'z48OHDhw8fPnz48OHDhw8fPnz48OHDhw8fPnz48M0IX0YFxDMe9P/' +
'nyDY+fPjw4cOHDx8+fPjw4cOHDx8+fPjw4cOHDx8+fNE223vpleEr' +
'MMC7vLAWrb2yFSrjETkjfPjw4cOHDx8+fPjw4cOHDx8+fPjw4cOHD' +
'x8+fPjw1Zev2ZxPb9LbevPEV5fWoy22WtEajblQGR/RZuxPxocPHz' +
'58+PDhw4cPHz58+PDhw4cPHz58+PDhw4cPX135/gCI5KNY');

A bit big, I know ^

dwimage

2013-06-06 22:46:34

with color alone, it is hard to do. but it is beautiful