Coordinates

Get help with using AutoHotkey and its commands and hotkeys
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Coordinates

08 Apr 2019, 10:24

How to make coordinates like that? https://imgur.com/a/O4btNMX NOT like that https://imgur.com/a/QcQBaQu. Here is my script

Code: Select all

LButton::
CoordMode, Mouse, Screen
MouseGetPos, posX, posY
if	((posX >= 719) && (posY >= 942)) || ((posX >= 995) && (posY >= 1008)) {
	SendInput {LButton down}
	Sleep, 100
	SendInput {LButton up}
}
else { 
	Send {RButton down}
	Sleep, 100
	Send {RButton up}
}
Return
m::Suspend
Thanks
User avatar
sinkfaze
Posts: 611
Joined: 01 Oct 2013, 08:01

Re: Coordinates

08 Apr 2019, 10:26

What is your script trying to do?
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

08 Apr 2019, 10:37

LButton act like RButton except when mouse cursor is on the written coordinates
User avatar
sinkfaze
Posts: 611
Joined: 01 Oct 2013, 08:01

Re: Coordinates

08 Apr 2019, 11:33

this line if ((posX >= 719) && (posY >= 942)) || ((posX >= 995) && (posY >= 1008)) doesn't really define the boundaries under which the code should work. If the area should be between two x/y coordinate then you should have >= and <= for x/y boundaries. Also, as logic goes you would want the statements connected with ANDs.

if (posX >= 719) && (posX <= 995) && (posY >= 942) && (posY <= 1008)
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

08 Apr 2019, 11:59

Already tried that if (posX >= 719) && (posX <= 995) && (posY >= 942) && (posY <= 1008)
not work where I want
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

08 Apr 2019, 12:04

If you know Leagues of Legends I want it where QWER is. (items will be good too)
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

08 Apr 2019, 15:33

It doesn't activate below Y942, but activate everywhere after X719
swagfag
Posts: 2836
Joined: 11 Jan 2017, 17:59

Re: Coordinates

08 Apr 2019, 16:02

some refactoring:

Code: Select all

CoordMode, Mouse, Screen

m::Suspend
#If !mouseInRegion(719, 942, 995, 1008)
LButton::Send {RButton}

mouseInRegion(x1, y1, x2, y2) {
	MouseGetPos x, y
	return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)
}
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

09 Apr 2019, 01:46

swagfag wrote:
08 Apr 2019, 16:02
some refactoring:

Code: Select all

CoordMode, Mouse, Screen

m::Suspend
#If !mouseInRegion(719, 942, 995, 1008)
LButton::Send {RButton}

mouseInRegion(x1, y1, x2, y2) {
	MouseGetPos x, y
	return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)
}
It works!!!!! Thank You. But I don't understand it.

Code: Select all

#If !mouseInRegion(719, 942, 995, 1008)
LButton::Send {RButton}
how the program know if it's in the region to send LButton, if it's not to send RButton??? It is possible to make it when I hold LBtton to hold RButton? I mean now it can't hold just click. Also how to add this script

Code: Select all

#NoEnv
#SingleInstance, force
SendMode, Input
#UseHook

LButton::
if (A_TickCount - RButton_Tick <= 350) AND (RButton_Tick >= 1)
	Send {g}
else
{
	Send {RButton down}
}
SetTimer, ClickBackUp, -1
RButton_Tick := A_TickCount
return	

ClickBackUp:
if !(GetKeyState("RButton" , "P"))
	Send {RButton up}
else
	SetTimer, ClickBackUp, -1
return
9::Suspend
(When I double click Send "g") So how to use both scripts without cancel the "ignore in coordinates" function?
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

09 Apr 2019, 06:59

I want to understand right how to do these " if mouse cursor is on parameter. x, x, x ,x"
swagfag
Posts: 2836
Joined: 11 Jan 2017, 17:59

Re: Coordinates

09 Apr 2019, 11:50

remap LButton to RButton if u want it to do the holding thing

Code: Select all

#If !mouseInRegion(719, 942, 995, 1008)
LButton::RButton
the rest i dont understand. its not clear what the end result should be after melding both scripts
SonGokuBg
Posts: 60
Joined: 27 Aug 2017, 12:40

Re: Coordinates

09 Apr 2019, 13:18

swagfag wrote:
09 Apr 2019, 11:50
remap LButton to RButton if u want it to do the holding thing

Code: Select all

#If !mouseInRegion(719, 942, 995, 1008)
LButton::RButton
the rest i dont understand. its not clear what the end result should be after melding both scripts
Thank You :bravo: ! Then why LButton::Send {RButton} inserted of just LButton::RButton? Sorry just want learn :shock: For the second questions I just want this script

Code: Select all

CoordMode, Mouse, Screen

m::Suspend
#If !mouseInRegion(719, 942, 1317, 1075)
LButton::RButton


mouseInRegion(x1, y1, x2, y2) {
	MouseGetPos x, y
	return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)
}
have function "when double click within x milliseconds press (g)" like this

Code: Select all

#NoEnv
#SingleInstance, force
SendMode, Input
#UseHook

LButton::
if (A_TickCount - RButton_Tick <= 350) AND (RButton_Tick >= 1)
	Send {g}
else
{
	Send {RButton down}
}
SetTimer, ClickBackUp, -1
RButton_Tick := A_TickCount
return	

ClickBackUp:
if !(GetKeyState("RButton" , "P"))
	Send {RButton up}
else
	SetTimer, ClickBackUp, -1
return
9::Suspend
Thank You and sorry!

Return to “Ask For Help”

Who is online

Users browsing this forum: DizzyH, Dumitas, flyingDman, Getfree, ineuw, teadrinker and 143 guests