Page 1 of 1
Creating a dot in the centre of the screen, toggleable on button hold
Posted: 08 Feb 2020, 15:04
by samarin
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
Re: Creating a dot in the centre of the screen, toggleable on button hold
Posted: 08 Feb 2020, 19:38
by scriptor2016
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
Re: Creating a dot in the centre of the screen, toggleable on button hold
Posted: 08 Feb 2020, 21:58
by samarin
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
Re: Creating a dot in the centre of the screen, toggleable on button hold
Posted: 08 Feb 2020, 23:42
by scriptor2016
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.