SRL Archive - SRL Archives

BlindClick


Quickmarch

2009-05-21 18:56:08

This was a function created by Cazax quite a while back, but it didn't take x and y as params. I just edited it to add the radius and angle dynamically. Full credits to Cazax for the original.


//By me and Cazax.
procedure MouseMM(x, y, xmod, ymod: Integer);
var
D2, R, Ang, MX, MY: Integer;

begin
Ang := Round(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90);
while Ang < 0 do Ang := Ang + 360;
D2 := Ang - Round(rs_GetCompassAngleDegrees);
R := Distance(MMCX, MMCY, x, y);
MX := MMCX + Round(R * Cos(Radians(D2 - 90)));
MY := MMCY + Round(R * Sin(Radians(D2 - 90)));
if rs_OnMiniMap(MX, MY) then Mouse(MX, MY, xmod, ymod, True);
end;

//Version 2, mixster
procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

What it does is click on the same x and y even if the compass is rotated.

Cazax

2009-05-21 22:15:10

I used this once in a Clay softener, never failed :D but no one seems to use it, apart from you.

Quickmarch

2009-05-21 22:25:19

From: Cazax
I used this once in a Clay softener, never failed :D but no one seems to use it, apart from you.


I thought it was a really cool function you made. :D Works great for map walking back-ups. :)

Dynamite

2009-05-21 22:31:20

I think ~RM uses it in his fisher ;)

T~M

Shuttleu

2009-05-21 22:32:21

i dont se how it works
explain

~shut

Quickmarch

2009-05-21 22:38:48

From: Shuttleu
i dont se how it works
explain

~shut


It just gets the Cos and Sin from the rs map minus the ArcTan of x and y.

Cazax

2009-05-21 22:40:39

Have you ever heard of trigonometry? Zeph and n3s have made tutorials about it :)

Shuttleu

2009-05-21 23:01:30

yes i know trigonometry

sine
cosine
tangent

Soh
Cah
Toa

Sine Opposite Hypotenuse
Cosine Adjacent Hypotenuse
Tangent Opposite Adjacent

~shut

Naum

2009-05-21 23:05:56

Or SOHCAHTOA :)

Shuttleu

2009-05-21 23:06:48

From: NaumanAkhlaQ
Or SOHCAHTOA :)


which is what i said

Soh
Cah
Toa

~shut

Sir R. M8gic1an

2009-05-21 23:36:01

indeed, i have used this, and find it to be extremely useful.

However, i'd use RotatePoint from wizzypluggin if i were to put it in srl ;) (check wizzypluggin.dpr in includes folder, not the .scar in misc)

~RM

Naum

2009-05-22 00:43:58

From: Shuttleu
which is what i said

Soh
Cah
Toa

~shut


Exactly thats why I mentioned the word Or! In the post above my friend :).

Anyway looks useful. Should be added.

Da 0wner

2009-05-22 00:48:22

He was just giving an even shorter abbreviation of abbreviations lol.

mixster

2009-05-22 01:04:24

Possibly add a check to see if it's on the minimap.
Possibly name that reflects what it does better - it seems to do the complete opposite of blind.

footballjds

2009-05-22 03:55:44

blind, is what it does. if you were blind and walking ten paces to the left, couldn't u turn around and do the opposite?
Blind just means it is a "blind click" solely based on coords. not a FindColor, or something ;)

Da 0wner

2009-05-22 03:59:02

From: mixster
Possibly add a check to see if it's on the minimap.
Possibly name that reflects what it does better - it seems to do the complete opposite of blind.


It is blind. It clicks coordinates that are not dynamic apart from clicking the same part in the angle/radius or whatever. In other words, it doesn't click the coordinates of a DTM/BMP/etc.

footballjds

2009-05-22 04:01:34

didn't i say that?
it is a blind click

Da 0wner

2009-05-22 04:04:23

I quoted Mixster because he said it was not blind. I also did not see your post as I had this page open for like 10 minutes without posting.

footballjds

2009-05-22 05:56:04

oh, kk!

Quickmarch

2009-05-22 09:17:39

Thanks guys for the feedback. :) I've added an rs_OnMiniMap check.

Shuttleu

2009-05-22 10:34:43

so explain what ArcTan2 does
im crap when it comes to visualising trigonometry

~shut

Gu3st...

2009-05-22 10:55:38

From: Shuttleu
so explain what ArcTan2 does
im crap when it comes to visualising trigonometry

~shut

You can use it to find (e. g) angles.

http://en.wikipedia.org/wiki/Arctan2

mixster

2009-05-22 21:57:32

Mouse blindly clicks, yet isn't called BlindMouse. I was suggesting a different name because it intelligently converts and clicks a point, rather than just doing a random click on the minimap…

Cazax

2009-05-22 22:43:53

I just noticed that what Quickmarch changed isn't doing what the function should do:
Procedure BlindMouse(Angle, Radius, Xmod, Ymod : Integer; Left : Boolean);
Var
D2 : Integer;
TP : TPoint;
Begin
D2 := FixD(Angle) - Round(rs_GetCompassAngleDegrees);
Tp.X := MMCX + Round(Radius * Cos(Radians(D2 - 90)));
Tp.Y := MMCY + Round(Radius * Sin(Radians(D2 - 90)));
Mouse(Tp.X, Tp.Y, Xmod, Ymod, Left);
End;

Shuttleu

2009-05-22 23:22:57

Procedure BlindMouse(Angle, Radius, Xmod, Ymod : Integer);
Var
D2 : Integer;
Tp : TPoint;
Begin
D2 := FixD(Angle) - Round(rs_GetCompassAngleDegrees);
Tp.X := MMCX + Round(Radius * Cos(Radians(D2 - 90)));
Tp.Y := MMCY + Round(Radius * Sin(Radians(D2 - 90)));
Mouse(Tp.X, Tp.Y, Xmod, Ymod, True);
End;
shouldnt Tp be a TPoint?
and theres no need to right click on the MM
~shut

Quickmarch

2009-05-23 13:46:12

From: Cazax
I just noticed that what Quickmarch changed isn't doing what the function should do:
Procedure BlindMouse(Angle, Radius, Xmod, Ymod : Integer; Left : Boolean);
Var
D2 : Integer;
TP : TPoint;
Begin
D2 := FixD(Angle) - Round(rs_GetCompassAngleDegrees);
Tp.X := MMCX + Round(Radius * Cos(Radians(D2 - 90)));
Tp.Y := MMCY + Round(Radius * Sin(Radians(D2 - 90)));
Mouse(Tp.X, Tp.Y, Xmod, Ymod, Left);
End;


What do you mean? All i did was put in ArcTan2 so you put in the x and y and it outputs the angle, aswell as the radius using the distance function.

Sir R. M8gic1an

2009-05-23 15:32:48

again… i'd suggest calling it ClickAngle and using RotatePoint from wizzy pluggin ;)

~RM

mixster

2009-05-23 15:54:06

Just to further RM's point,


procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

Voila, it all fits onto one line and then the Mouse. Went for MouseMM as a name since it's short for MouseMiniMap, though you can stick with BlindMouse if you want. I've tested it already and RotatePoint definitely works using Radians. Assuming that rs_GetCompassAngle works on a North = 0 logic, that should rotate the point correctly.

Quickmarch

2009-05-23 16:29:43

From: mixster
Just to further RM's point,


procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

Voila, it all fits onto one line and then the Mouse. Went for MouseMM as a name since it's short for MouseMiniMap, though you can stick with BlindMouse if you want. I've tested it already and RotatePoint definitely works using Radians. Assuming that rs_GetCompassAngle works on a North = 0 logic, that should rotate the point correctly.


Ahh ok, i tested it with RotatePoint and it didn't work with degrees. :duh: Also, good name. :)
I'll leave the original as it is and post this one up next to it.

Shuttleu

2009-05-23 20:15:00

From: mixster
Just to further RM's point,


procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

Voila, it all fits onto one line and then the Mouse. Went for MouseMM as a name since it's short for MouseMiniMap, though you can stick with BlindMouse if you want. I've tested it already and RotatePoint definitely works using Radians. Assuming that rs_GetCompassAngle works on a North = 0 logic, that should rotate the point correctly.
that doesnt work properly
it works fine if the compas is north but i changed it to SE and it clicked way too far north

~shut

Quickmarch

2009-05-23 21:28:29

From: Shuttleu
that doesnt work properly
it works fine if the compas is north but i changed it to SE and it clicked way too far north

~shut


Hmmm, same for me too…

Shuttleu

2009-05-23 21:33:54

let RM show us :)

~shut

n3ss3s

2009-05-23 23:26:49

This function is a little dangerous, as if you'd want it to hit the "original" place, you'd have to give it the angle the coords were taken at…

Shuttleu

2009-05-23 23:37:02

From: n3ss3s
This function is a little dangerous, as if you'd want it to hit the "original" place, you'd have to give it the angle the coords were taken at…

then use Cazax's one
that takes the angle which the coords were taken at

~shut

mixster

2009-05-24 00:44:16

Double checked my procedure - am 99% sure it is right. RotatePoint takes in radians. rs_GetCompassAngleRadians returns a result compensated for west being 0 degrees. Try lowering randX and randY as that may affect it or make sure compass was already north when taken. It is possible that rs_GetCompassAngle isn't working properly though. I would be 100% sure, but then I would have to log in to RS and test it.

Shuttleu

2009-05-24 00:52:05

i am sure that it was already north when i took the coords
and i have tried differant points on the mm
Cazax's works perfectly fine :)

~shut

EDIT:if you want it all on one line then just do this
Procedure BlindMouse(Angle, Radius, Xmod, Ymod : Integer);
Begin
Mouse((MMCX + Round(Radius * Cos(Radians((Round(FixD(Angle)) - Round(rs_GetCompassAngleDegrees)) - 90)))), (MMCY + Round(Radius * Sin(Radians((Round(FixD(Angle)) - Round(rs_GetCompassAngleDegrees)) - 90)))), Xmod, Ymod, True);
End;
and
procedure MouseMM(x, y, xmod, ymod: Integer);
begin
if rs_OnMiniMap((MMCX + Round((Distance(MMCX, MMCY, x, y)) * Cos(Radians(((Round(FixD(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90))) - Round(rs_GetCompassAngleDegrees)) - 90)))), (MMCY + Round((Distance(MMCX, MMCY, x, y)) * Sin(Radians(((Round(FixD(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90))) - Round(rs_GetCompassAngleDegrees)) - 90))))) then Mouse((MMCX + Round((Distance(MMCX, MMCY, x, y)) * Cos(Radians(((Round(FixD(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90))) - Round(rs_GetCompassAngleDegrees)) - 90)))), (MMCY + Round((Distance(MMCX, MMCY, x, y)) * Sin(Radians(((Round(FixD(Degrees(ArcTan2(y - MMCY, x - MMCX)) + 90))) - Round(rs_GetCompassAngleDegrees)) - 90)))), xmod, ymod, True);
end;

marpis

2009-05-27 20:39:15

mixters function is working properly, but you have to pick the cords when the MM is pointing North

Sir R. M8gic1an

2009-06-12 19:42:45

tested mixster's function. it was a whole 180% off for me, so i changed it to 0 - RsAngle;


procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), 0 - rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

i'll add to svn as soon as somebody else tests it.

~RM

Quickmarch

2009-06-12 19:52:58

From: Rasta Magician
tested mixster's function. it was a whole 180% off for me, so i changed it to 0 - RsAngle;


procedure MouseMM(x, y, randX, randY: Integer);
var
p: TPoint;
begin
if not rs_OnMinimap(x, y) then
exit;
p := RotatePoint(Point(x, y), 0 - rs_GetCompassAngleRadians, MMCX, MMCY);
Mouse(p.x, p.y, randX, randY, True);
end;

i'll add to svn as soon as somebody else tests it.

~RM


Works for me.