Page 1 of 1

Coordinates

Posted: 08 Apr 2019, 10:24
by SonGokuBg
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

Re: Coordinates

Posted: 08 Apr 2019, 10:26
by sinkfaze
What is your script trying to do?

Re: Coordinates

Posted: 08 Apr 2019, 10:37
by SonGokuBg
LButton act like RButton except when mouse cursor is on the written coordinates

Re: Coordinates

Posted: 08 Apr 2019, 11:33
by sinkfaze
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)

Re: Coordinates

Posted: 08 Apr 2019, 11:59
by SonGokuBg
Already tried that if (posX >= 719) && (posX <= 995) && (posY >= 942) && (posY <= 1008)
not work where I want

Re: Coordinates

Posted: 08 Apr 2019, 12:04
by SonGokuBg
If you know Leagues of Legends I want it where QWER is. (items will be good too)

Re: Coordinates

Posted: 08 Apr 2019, 15:33
by SonGokuBg
It doesn't activate below Y942, but activate everywhere after X719

Re: Coordinates

Posted: 08 Apr 2019, 16:02
by swagfag
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)
}

Re: Coordinates

Posted: 09 Apr 2019, 01:46
by SonGokuBg
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?

Re: Coordinates

Posted: 09 Apr 2019, 06:59
by SonGokuBg
I want to understand right how to do these " if mouse cursor is on parameter. x, x, x ,x"

Re: Coordinates

Posted: 09 Apr 2019, 11:50
by swagfag
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

Re: Coordinates

Posted: 09 Apr 2019, 13:18
by SonGokuBg
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!