Advertisement
Guest User

Game Crosshair

a guest
Jun 25th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Modify these values
  2. CrosshairWidth = 2
  3. CrosshairLength = 23
  4. CrosshairColor = FF00FF
  5. GameName = 7 Days To Die
  6.  
  7. ;Do not modify below this line
  8.  
  9. #NoEnv
  10. #SingleInstance Force
  11. SetWinDelay 0
  12. Coordmode Mouse, Screen
  13. WS_BORDER:= 0x800000
  14. WS_CAPTION:=0xC00000
  15.  
  16.  
  17. ID1 := Box(1,CrosshairWidth,CrosshairLength)
  18. ID2 := Box(2,CrosshairLength,CrosshairWidth)
  19.  
  20. IfWinNotActive, %GameName%
  21. {
  22.     Gui %ID1%: hide
  23.     Gui %ID2%: hide
  24. }
  25.  
  26. RulerX:= A_ScreenWidth/2-Ceil(CrosshairWidth/2)
  27. RulerY:= A_ScreenHeight/2-Ceil(CrosshairWidth/2)
  28.  
  29. WinMove ahk_id %ID1%,, %RulerX%, % RulerY-Floor(CrosshairLength/2)+1
  30. WinMove ahk_id %ID2%,, % RulerX-Floor(CrosshairLength/2)+1, %RulerY%
  31.  
  32. loop
  33. {
  34.     WinWaitActive, %GameName%
  35.     Winset AlwaysOnTop,ON,ahk_id %ID1% ;needed for some games
  36.     Winset AlwaysOnTop,ON,ahk_id %ID2% ;needed for some games
  37.     Gui %ID1%: Show, NoActivate
  38.     Gui %ID2%: Show, NoActivate
  39.     WinWaitNotActive, %GameName%
  40.     Gui %ID1%: hide
  41.     Gui %ID2%: hide
  42. }
  43.  
  44. return
  45.  
  46. Box(n,wide,high)
  47. {
  48.     global CrosshairColor
  49.     Gui %n%:-Caption +ToolWindow +E0x20 +hwndID ; No title bar, No taskbar button, Transparent for clicks
  50.     Gui %n%:Color, %CrosshairColor%,0 ; Set background color to CrosshairColor
  51.     Gui %n%: Show, Center W%wide% H%high% NoActivate ; Show it
  52.     Winset AlwaysOnTop,ON,ahk_id %ID% ; Keep it always on the top
  53.     WinSet Transparent,255,ahk_id %ID% ; make it transparent
  54.     Return ID
  55. }
  56.  
  57. !F1::
  58. IfWinExist %GameName%
  59. {
  60. WinSet, Style, -%WS_BORDER%, %GameName%
  61. WinSet, Style, -%WS_CAPTION%, %GameName%
  62. WinMove, %GameName%,, 0, 0, A_ScreenWidth, A_ScreenHeight
  63. }
  64. else
  65.     msgbox, Game window not found.
  66. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement