I'm having difficulty posting youtube video on the forum without the link breaking
___________________________________________________________________
I'm playing on 1360x768
I want the ability to toggle zoom in on the center of the screen (centerpoint for my resolution is 680 384)(not sure how large the magnified window needs to be)
This will allow the player to zoom in without aiming down the sights
It is useful because aiming down the sights will cause some objects to render in at distance (grass, bushes, trees)
Also useful because some factions are ironsight only and do not have scopes, so this will allow ironsight classes to be competitive against scopes at range
Additionally, some kits are not provided binoculars
I've searched the internet for quite awhile and found two AHK scripts that are nearly functional
https://www.autohotkey.com/boards/viewtopic.php?t=29270
In addition to this relevant thread (Screen Magnifier V2)
https://www.autohotkey.com/boards/viewtopic.php?t=29270
The problems that I am having now:
The magnifier focus is following the mouse cursor when I just want it to lock on the middle of the screen coordinates then draw a viewing box 400 pixels large
The magnified window overlapping, is there a way to have the magnifier window be transparent to itself?
Here are some examples of the effect this would have in a FPS game
[ youtube ] https :// www.youtube.com /watch?v=7k6SitNNxnc[ / youtube ] Broken Link for safety
__________________________________________________________________________________________________________________________________________
These are the two scripts I have found by googling online and have attempted to make small edits to both already
*
Script in Progress:
Code: Select all
#Persistent
#NoEnv
Menu,Tray,NoStandard
OnExit handle_exit
State=0
; the specific (absolute) x, y to be magnified,
start_x:= 680, start_y:= 384
; the display of the magnified image x, y, w, h
xx:=000, yy:= 00, ww:=400, hh:=400
Alt:: ;hotkey here
key_to_scope:
State:=!State
send {Ctrl up}
send {Ctrl down}
send {Ctrl up}
If state
{
Gui, +AlwaysOnTop +E0x20 -Caption +Owner +Resize -ToolWindow
Gui, Show, NoActivate w300 h220 x0 y0 , PrintScreen
zoom:=1
antialize:=1
delay:=1
WinGet PrintScreenID, id ,PrintScreen
WinSet Transparent, 254, PrintScreen
WinGet, PrintSourceID, id
hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
hdc_frame := DllCall( "GetDC", UInt, PrintScreenID )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame)
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
Gosub, Repaint
return
Repaint:
CoordMode, Mouse, Screen
MouseGetPos, start_x, start_y
Gui, Submit, NoHide
GuiControl,, delay2 , delay %delay% ms
WinGetPos, wx, wy, ww, wh , PrintScreen
wh2 := wh
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 * antialize )
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,0, Int,ww, Int,wh
, UInt,hdd_frame, Int
, start_x-(ww / 2 / zoom)
, Int,start_y -( wh2 / 2/zoom), Int,ww / zoom, Int,wh2 / zoom ,UInt,0xCC0020)
if follow = 1
WinMove, PrintScreen, ,start_x -ww/2 , start_y-wh/2
SetTimer, Repaint , %delay%
Return
GuiClose:
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp xxxxx
}
Else
Gui Destroy
Return
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Screen Magnifier by Holomind
Code: Select all
; the specific (absolute) x, y to be magnified,
start_x:= 680, start_y:= 384
; the display of the magnified image x, y, w, h
xx:=000, yy:= 00, ww:=400, hh:=400
;ScreenMagnifier from holomind
;https://autohotkey.com/board/topic/10660-screenmagnifier/
OnExit handle_exit
Gui, +AlwaysOnTop +Owner +Resize +ToolWindow ; window for the dock
Gui, Show, NoActivate w%ww% h%hh% x%xx% y%yy% , PrintScreen
Gui, Add, DDL, vzoom , 0.5|1|2||4|8|16
Gui, Add, Checkbox, y12 x150 vantialize, Antialize ?
Gui, Add, Slider, vdelay x220 y0 Range15-200
Gui, Add, Text, x340 y12 w80 vdelay2
WinGet PrintScreenID, id ,PrintScreen ;
WinSet, Transparent , 254, PrintScreen
;retrieve the unique ID number (HWND/handle) of that window
WinGet, PrintSourceID, id
hotkey , #x , toggle_follow
hotkey , +$LButton , click_through
toolbar_def:=35
toolbar := toolbar_def
follow :=0
hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
hdc_frame := DllCall( "GetDC", UInt, PrintScreenID )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
Gosub, Repaint
return
toggle_follow:
follow := 1 - follow
if follow = 1
{
WinSet Region, 0-0 W%ww% H%wh% E , PrintScreen
toolbar := -32 ; height of window title
GuiControl, Hide, zoom
}
else
{
WinSet Region,, PrintScreen
toolbar :=toolbar_def
GuiControl, Show, zoom
}
Return
click_through:
if follow = 1
{
Gui, Hide
Send, {Click}
SetTimer, Repaint , Off
Sleep, 100
Gui, Show
SetTimer, Repaint, %delay%
}
Return
Repaint:
CoordMode, Mouse, Screen
;MouseGetPos, start_x, start_y ; position of mouse
Gui, Submit, NoHide ; needed to read the dropdown and slidervalue
GuiControl,, delay2 , delay %delay% ms
WinGetPos, wx, wy, ww, wh , PrintScreen
wh2 := wh - toolbar
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 * antialize ) ; Halftone better quality with stretch
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,toolbar, Int,ww, Int,wh - toolbar
, UInt,hdd_frame, Int
, start_x-(ww / 2 / zoom)
, Int,start_y -( wh2 / 2/zoom), Int,ww / zoom, Int,wh2 / zoom ,UInt,0xCC0020) ; SRCCOPY
if follow = 1
WinMove, PrintScreen, ,start_x -ww/2 , start_y-wh/2
SetTimer, Repaint , %delay%
Return
GuiClose:
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp
Script of resources (need to use the focus on center of screen from this script, so that the magnifier will not follow mouse cursor)
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; the specific (absolute) x, y to be magnified,
start_x:= 680, start_y:= 384
; the display of the magnified image x, y, w, h
xx:=380, yy:= 164, ww:=600, hh:=440
;ScreenMagnifier from holomind
;https://autohotkey.com/board/topic/10660-screenmagnifier/
OnExit handle_exit
Gui, +AlwaysOnTop +Owner +Resize +ToolWindow ; window for the dock
Gui, Show, NoActivate w%ww% h%hh% x%xx% y%yy% , PrintScreen
Gui, Add, DDL, vzoom , 0.5|1|2||4|8|16
Gui, Add, Checkbox, y12 x150 vantialize, Antialize ?
Gui, Add, Slider, vdelay x220 y0 Range1-200
Gui, Add, Text, x340 y12 w80 vdelay2
WinGet PrintScreenID, id ,PrintScreen ;
WinSet, Transparent , 254, PrintScreen
;retrieve the unique ID number (HWND/handle) of that window
WinGet, PrintSourceID, id
hotkey , #x , toggle_follow
hotkey , +$LButton , click_through
toolbar_def:=35
toolbar := toolbar_def
follow :=0
hdd_frame := DllCall( "GetDC", UInt, PrintSourceID )
hdc_frame := DllCall( "GetDC", UInt, PrintScreenID )
hdc_buffer := DllCall("gdi32.dll\CreateCompatibleDC", UInt, hdc_frame) ; buffer
hbm_buffer := DllCall("gdi32.dll\CreateCompatibleBitmap", UInt,hdc_frame, Int,A_ScreenWidth, Int,A_ScreenHeight)
Gosub, Repaint
return
toggle_follow:
follow := 1 - follow
if follow = 1
{
WinSet Region, 0-0 W%ww% H%wh% E , PrintScreen
toolbar := -32 ; height of window title
GuiControl, Hide, zoom
}
else
{
WinSet Region,, PrintScreen
toolbar :=toolbar_def
GuiControl, Show, zoom
}
Return
click_through:
if follow = 1
{
Gui, Hide
Send, {Click}
SetTimer, Repaint , Off
Sleep, 100
Gui, Show
SetTimer, Repaint, %delay%
}
Return
Repaint:
CoordMode, Mouse, Screen
;MouseGetPos, start_x, start_y ; position of mouse
Gui, Submit, NoHide ; needed to read the dropdown and slidervalue
GuiControl,, delay2 , delay %delay% ms
WinGetPos, wx, wy, ww, wh , PrintScreen
wh2 := wh - toolbar
DllCall( "gdi32.dll\SetStretchBltMode", "uint", hdc_frame, "int", 4 * antialize ) ; Halftone better quality with stretch
DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,toolbar, Int,ww, Int,wh - toolbar
, UInt,hdd_frame, Int
, start_x-(ww / 2 / zoom)
, Int,start_y -( wh2 / 2/zoom), Int,ww / zoom, Int,wh2 / zoom ,UInt,0xCC0020) ; SRCCOPY
if follow = 1
WinMove, PrintScreen, ,start_x -ww/2 , start_y-wh/2
SetTimer, Repaint , %delay%
Return
GuiClose:
handle_exit:
DllCall("gdi32.dll\DeleteObject", UInt,hbm_buffer)
DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
DllCall("gdi32.dll\DeleteDC", UInt,hdc_buffer)
ExitApp