SRL Archive - Outdated Tutorials

Find A color And Click


atmmaster2

2007-05-29 04:41:09

This Is My Very First TUT So Please Rate It

Hi i started scripted not that long ago and im not that good but i thought i would give a helping hand to the people who don't know how to do certain things with SCAR.


If you are confused by any of this dont worry im putting a simple quide at the end.

Step1. (Make the commands)


Program New;
Var

Const
Color1=000000;

Procedure Color_click;
Begin
If(Findcolor(x, y, Color1, 1, 1, 600, 600))then
mmouse(x, y, 2, 2);
mouse(x, y, 1, 1, true);
End.

Now If you dont know what these commands are i will tell you
if(findcolor(x, y, Color1, 1, 1, 600, 600))

This basicly means if SCAR finds Color1 it will remember where it is (x, y,) and it will move to it with a tolerance of 1 pixel.

mmouse(x, y, 2, 2)
Basicly means move the mouse to the (x, y,) it remembered at the start but to a tolerance of 2 pixels.

mouse(x, y, 1, 1, true)
Means left click the (x, y,) at the same spot its remembered it at.

Now We need to find the color we want to click and select it with the SCAR color picker (the little ink thing at the top of scar).

Once you have picked the color copy and the paste the color here
Const
Color1=Paste it here

Now that will simply find the color you picked as Color1 move the mouse to it and click on it. Thats all that this script will do.

####QUICK GUIDE####
mmouse(x, y, 1, 1,)
This Command Moves The Mouse To The X, Y, Coordinites
mouse(x, y, 1, 1, true)
This Command Clicks The Mouse At The X, Y, Coordinites
If(FindColor(x, y, Color1, 1, 1, 600, 600))
This Command Finds The Color You Picked And "Remembers" Its Coordinites.

Hugolord

2007-05-29 04:50:20

From: atmmaster2
This Is My Very First TUT So Please Rate It

Hi i started scripted not that long ago and im not that good but i thought i would give a helping hand to the people who don't know how to do certain things with SCAR.


If you are confused by any of this dont worry im putting a simple quide at the end.

Step1. (Make the commands)


Program New;
Var

Const
Color1=000000;

Procedure Color_click;
Begin
If(Findcolor(x, y, Color1, 1, 1, 600, 600))then
mmouse(x, y, 2, 2);
mouse(x, y, 1, 1, true);
End.

Now If you dont know what these commands are i will tell you
if(findcolor(x, y, Color1, 1, 1, 600, 600))

This basicly means if SCAR finds Color1 it will remember where it is (x, y,) and it will move to it with a tolerance of 1 pixel.

mmouse(x, y, 2, 2)
Basicly means move the mouse to the (x, y,) it remembered at the start but to a tolerance of 2 pixels.

mouse(x, y, 1, 1, true)
Means left click the (x, y,) at the same spot its remembered it at.

Now We need to find the color we want to click and select it with the SCAR color picker (the little ink thing at the top of scar).

Once you have picked the color copy and the paste the color here
Const
Color1=Paste it here

Now that will simply find the color you picked as Color1 move the mouse to it and click on it. Thats all that this script will do.

####QUICK GUIDE####
mmouse(x, y, 1, 1,)
This Command Moves The Mouse To The X, Y, Coordinites
mouse(x, y, 1, 1, true)
This Command Clicks The Mouse At The X, Y, Coordinites
If(FindColor(x, y, Color1, 1, 1, 600, 600))
This Command Finds The Color You Picked And "Remembers" Its Coordinites.


just a lil something :

mouse(x, y, 1, 1, true)

The 'true' means it will left click with the mouse

if you put 'false' it will right click with the mouse

gd guide overall tho :p

Rune Killer

2007-05-29 06:40:22

Not bad for a first guide, keep it up ;)

tim46

2007-05-29 20:49:51

Not a bad tutorial I guess…just improve your spelling, and also edit this:

Program New;
Var

Const
Color1=000000;

Procedure Color_click;
Begin
If(Findcolor(x, y, Color1, 1, 1, 600, 600))then
mmouse(x, y, 2, 2);
mouse(x, y, 1, 1, true);
End.
You don't need to put
mmouse(x, y, 2, 2); and mouse(x, y, 1, 1, true);
All you need is mouse(x, y, 1, 1, true); Mouse moves the crusor, and clicks.

procedure Mouse(mousex, mousey, ranx, rany: Integer; left: Boolean);
By: Mutant Squirrle
Description:
Moves then clicks mouse.

dark4mdawn

2007-07-10 16:54:58

looks good trying learn find color funtion thks

sukomabawls

2007-07-12 02:04:10

pretty nice guide 7/10, could use maybe 2 more color const to give more flexibilty to scar.

Like this.

Color1=000000;
Color2=000000;
Color3=000000;
Procedure Color_click;
Begin
If(Findcolor(x, y, Color1,Color2,Color3, 1, 1, 600, 600))then
mmouse(x, y, 2, 2);
mouse(x, y, 1, 1, true);
End.
Nice though, good job on first TUT!!

BobboHobbo

2007-07-13 01:26:04

Nice job it wil help the new very new SCAR learners and people who forget.

Good Job Rep+

Violentypro

2007-07-17 21:37:02

And you also forgot the
program WhatEver;
{.include SRL/SRL.scar}
//some procedures etc...

begin
SetupSRL;
//Even more script...(im to lazy to click the quote button :P)
end.

Else…Good job.

Zeta

2007-08-01 04:39:31

Hey tyvm although you need to get rid of the vars.. thank you again!

cathering_

2007-08-01 05:24:18

Good tutorial but , It dose not nessarily "remember" x, y in the findcolor function, it returns but i guest its good enoth :)

ZephyrsFury

2007-08-01 07:36:09

From: sukomabawls
pretty nice guide 7/10, could use maybe 2 more color const to give more flexibilty to scar.

Like this.

Color1=000000;
Color2=000000;
Color3=000000;
Procedure Color_click;
Begin
If(Findcolor(x, y, Color1,Color2,Color3, 1, 1, 600, 600))then
mmouse(x, y, 2, 2);
mouse(x, y, 1, 1, true);
End.
Nice though, good job on first TUT!!


I don't think that will work…. FindColor only works with one colour at a time. You will need to do something like this:


If (Findcolor(x, y, Color1, 1, 1, 600, 600)) or
(Findcolor(x, y, Color2, 1, 1, 600, 600)) or
(Findcolor(x, y, Color3, 1, 1, 600, 600))then
mouse(x, y, 1, 1, true);

faster789

2007-08-23 12:33:06

lol this may be nuby but why does mine say unknow identifier x

jas0npc

2007-09-02 17:30:55

many thanks for this, I am attempting to create a script that will select the clippers in pack then select a sheep and shear it walk to bank and bank it.

can i use this example to choose a differnt sheep every time so that it dosnt seem to be autoed?..

LOL 1st script but i need it, Might as well start at deep end..

Method

2007-09-02 18:08:10

Make sure you declare x and y as integers at the top otherwise the script won't compile. Looks like someone's already noticed that (2 posts up).

gothicly2

2007-09-02 19:51:10

Cool good tut, could really help out the new scriptees!

Erox

2007-10-24 08:04:16

I've been using this tutorial on on a lot of test scripts.
Thanx.

EvilChicken!

2007-10-25 02:12:17

From: hugolord
just a lil something :

mouse(x, y, 1, 1, true)

The 'true' means it will left click with the mouse

if you put 'false' it will right click with the mouse

gd guide overall tho :p


What was the point of quoting the whole thing?

Like what I'm doing now. Annoying, isn't it?



:sasmokin:

Fused

2007-10-26 09:01:05

From: Metho D
Make sure you declare x and y as integers at the top otherwise the script won't compile. Looks like someone's already noticed that (2 posts up).


Can you do a working example with the integers as i dont understand

blitzwing

2007-10-28 01:14:37

ive needed somethin like this
thanks!

thedarkmage

2007-10-28 20:54:31

lol, nice work but what's the point of findcolor? Isn't it a little too weak? findcolortolerance(x,y,color[1],msx1,msy1,msx2,msy2,2):Finds a color(color[1]) in the main screen with a colortolerance of two and stores the coordinates in x and y

Tri

2007-11-02 09:44:03

That seems like it will auto find the color right?

wafyl

2007-11-05 16:58:10

Thanks, this really helped!

Raskolnikov

2007-11-09 00:15:09

Good job! But I think you should do something that describes the function like:


if(FindColor(x,y:integer,color,)//ect...

Thanks though!

migaeler1

2007-12-22 11:47:12

nice for first TUT! good job!