Left mouse button only when certain area Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Desiet

Left mouse button only when certain area

13 Dec 2017, 02:35

I want my program to run only when I click with the left mouse button on a certain part of the game

So I have the code

~LButton::
Suspend, On

Now, I know the exact location where the game object is thanks to the spy tool.

So now I need to know, how do I detect when I click the left mouse button at the area I specified.

I know mousegetpos and I know to set the coord mode, but I don't know how to detect
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Left mouse button only when certain area  Topic is solved

13 Dec 2017, 03:22

MouseGetPos returns a couple of variables with the X and Y coordinates of the mouse. Simply use one or more If statements to check those variables for the coordinates that you're after... something like so:

Code: Select all

~LButton::
  MouseGetPos, MouseX, MouseY
  If MouseX between 0 and 100
    If MouseY between 0 and 100
      Suspend, On
Return
BTW, I like how you marked your problem as the answer ;).
Desiet

Re: Left mouse button only when certain area

13 Dec 2017, 11:32

Osprey wrote:MouseGetPos returns a couple of variables with the X and Y coordinates of the mouse. Simply use one or more If statements to check those variables for the coordinates that you're after... something like so:

Code: Select all

~LButton::
  MouseGetPos, MouseX, MouseY
  If MouseX between 0 and 100
    If MouseY between 0 and 100
      Suspend, On
Return
BTW, I like how you marked your problem as the answer ;).
i fixed it :thumbup:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], joedf, scriptor2016, supplementfacts and 143 guests