Creating a dot in the centre of the screen, toggleable on button hold

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
samarin
Posts: 4
Joined: 08 Feb 2020, 14:55

Creating a dot in the centre of the screen, toggleable on button hold

08 Feb 2020, 15:04

I am looking to create a script that will display an overlay of a small red dot in the centre of the screen. This could either be done by using a .png of a dot, or drawing one. When RButton is pressed and held down, the dot will dissappear. When RButton is not pressed down anymore, the dot will reappear. Could I get some pointers, help or tips on this please? Thanks
scriptor2016
Posts: 849
Joined: 21 Dec 2015, 02:34

Re: Creating a dot in the centre of the screen, toggleable on button hold

08 Feb 2020, 19:38

Hopefully this can get you started:

Code: Select all

diam = 60	; diameter of dot

Gui -Caption +AlwaysOnTop
Gui margin,0,0
Gui add, ListView,	w%diam% h%diam%	-Hdr -E0x200 BackgroundRed
SysGet, mon, MonitorWorkArea		; get screen size (to include taskbar height delete text 'WorkArea')
Gui show, % "x" monRight//2-(diam//2) " y" monBottom//2-(diam//2), DOT
WinSet, Region, 0-0 W%diam% H%diam% E, A		; make it circular
return

~rbutton::
winhide, DOT
keywait, rbutton
winshow, DOT
Return
samarin
Posts: 4
Joined: 08 Feb 2020, 14:55

Re: Creating a dot in the centre of the screen, toggleable on button hold

08 Feb 2020, 21:58

scriptor2016 wrote:
08 Feb 2020, 19:38

Code: Select all

~rbutton::
winhide, DOT
keywait, rbutton
winshow, DOT
Return
Is there a way to do this without the winhide and winshow functions? As this is causing my game to go in and out of focus
scriptor2016
Posts: 849
Joined: 21 Dec 2015, 02:34

Re: Creating a dot in the centre of the screen, toggleable on button hold

08 Feb 2020, 23:42

I'm not sure why that's happening. Do you mean that your game is no longer the active window when right-clicking down and holding? Is some other window taking focus?

On my end, right-clicking hides the dot but does not affect the active window.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 244 guests