SRL Archive - SRL Archives

ClickColor


XabdullahX

2009-06-05 19:14:52

Hi.

I dont know if this is usefull, just a product of boredom.

It detects if your click is red (action-click) or yellow (empty-click)


Function ClickColor: String;
var
x, y : Integer;
begin
GetMousePos(x,y);
If (FindColor(x,y,65535,MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'yellow'
end else if (FindColor(x,y,255, MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'red'
end;
end;

Torrent of Flame

2009-06-05 19:21:28

function ClickColor: String;
var
x, y : Integer;
begin
GetMousePos(x,y);
if (FindColor(x,y,65535,MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'yellow';
end else
Result := 'red';
end;

You don't need that. There are only 2 types of click, so if is not yellow it has to be red.

Naum

2009-06-05 19:23:53

function ClickColor: String;
var
x, y : Integer;
begin
GetMousePos(x,y);
if (FindColor(x,y,65535,MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'yellow';
end else
Result := 'red';
end;
Is better to this:

function ClickColor(x, y : Integer): String;
begin
if (FindColor(x,y,65535,x - 20,x - 20,x + 20,y + 20)) then
Result := 'yellow'
else
Result := 'red';
end;

Torrent of Flame

2009-06-05 19:26:01

From: NaumanAkhlaQ
function ClickColor: String;
var
x, y : Integer;
begin
GetMousePos(x,y);
if (FindColor(x,y,65535,MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'yellow';
end else
Result := 'red';
end;
Is better to this:

function ClickColor(x, y : Integer): String;
begin
if (FindColor(x, y, 65535,x - 20, y - 20, x + 20, y + 20)) then
Result := 'yellow'
else
Result := 'red';
end;


Ah yes but then that requires you input your own x and y, which I suppose wouldnt be that hard. Never mind ahah. Also fixed your little error.

Naum

2009-06-05 19:27:43

You can do a getmousepos before it :)

ian.

2009-06-05 20:11:51

You took out the GetMousePos();, didn't you? :]

XabdullahX

2009-06-05 20:20:42

i dont think so naukman, becuase what if it doesnt detect anything at all ?, then it will be red no matter what.

But do anyone know what this can be used for -.-' ?

ian.

2009-06-05 20:31:16

Anti-ban, maybe? =X All that I can think of. But I'm in school and can't really think about anything D: Haha. And it's just good to understand stuff ^^ Maybe you could implement it in a script you make somehow. Good luck :]

Naum

2009-06-05 20:32:56

[mixster]The name is NaumanAkhlaQ not 'naukman'[/mixster]

But so shall TOF's one?

So in the end you need two separate statements!

It cannot be useful for anything expect checking a color. E.g - use a bad color to find, say, a coal rock. You find it in like 5 seconds (because of the bad color), then you use this ClickColor thingy to get the color at the mouse position, thus refining it and using it during script run time.

That's the only reason I can think of, but even though it is a good try - it might not be added.

Keep it up though.
But good try :)

Richard

2009-06-05 21:40:08

From: NaumanAkhlaQ
[mixster]The name is NaumanAkhlaQ not 'naukman'[/mixster]

But so shall TOF's one?

So in the end you need two separate statements!

It cannot be useful for anything expect checking a color. E.g - use a bad color to find, say, a coal rock. You find it in like 5 seconds (because of the bad color), then you use this ClickColor thingy to get the color at the mouse position, thus refining it and using it during script run time.

That's the only reason I can think of, but even though it is a good try - it might not be added.

Keep it up though.
But good try :)


Mixster is here? :O Where?

Could you not make it a boolean? Call it RedMouse: Boolean; ?

Kasi

2009-06-06 00:05:23

From: Torrent of Flame
function ClickColor: String;
var
x, y : Integer;
begin
GetMousePos(x,y);
if (FindColor(x,y,65535,MSX1,MSY1,MSX2,MSY2)) then
begin
Result := 'yellow';
end else
Result := 'red';
end;

You don't need that. There are only 2 types of click, so if is not yellow it has to be red.


erm on the click what if it click somewhere where it doesnt go red or yellow
the result will still be red so the original 1 should be right

Torrent of Flame

2009-06-06 00:13:22

From: pur3b100d
erm on the click what if it click somewhere where it doesnt go red or yellow
the result will still be red so the original 1 should be right


Well this searches the Main Screen, and if you click the Main Screen it will always give a yellow or a red click.

Kasi

2009-06-06 00:48:03

not if its rightclicking

Torrent of Flame

2009-06-06 12:54:25

From: pur3b100d
not if its rightclicking


Well if you was right clicking you wouldn't even use this procedure.

Sir R. M8gic1an

2009-06-06 13:20:25

slightly better version from my fighter..


Function ClickedMonster(TP : TPoint): boolean;
var
t, waste: integer;
begin
t := GetSystemTime;
while GetSystemTime - t <= 1000 do
begin

if FindColor(waste, waste, 255, TP.x - 10, TP.y - 10, TP.x + 10, TP.y +10) then
begin
Result := true;
break;
end;

if FindColor(waste, waste, 65535, TP.x - 10, TP.y - 10, TP.x + 10, TP.y+10) then
break;
end;
end;

~RM