Skip to content

Commit

Permalink
improvements and guides
Browse files Browse the repository at this point in the history
  • Loading branch information
etofok committed Sep 5, 2024
1 parent 342ddfb commit 423906d
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 59 deletions.
29 changes: 29 additions & 0 deletions Image_Overlay/How to align the overlay to your resolution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
;----------------------

"IMAGE_OVERLAY.png" is a 1920x1080 transparent image.

Displaced Grid overlays this image directly on top of the Warcraft III:Reforged window.



If you play in a different resolution than 1920x1080 - you need to adjust the overlay.

Use the provided "IMAGE_OVERLAY (for editing).psd" in this folder.



1. Open "IMAGE_OVERLAY (for editing).psd" in Photoshop or any online .psd editor.

2. Paste your in-game screenshot (as a temporary reference) and align the overlay on top of it.

3. Don't forget to remove the in-game screenshot before exporting.

4. Export as .png to keep the transparency.

5. The overlay image should be named exactly "IMAGE_OVERLAY.png".

P.S. Save the .psd file as well in case you'll need to edit it later.

That's it!

;----------------------
34 changes: 34 additions & 0 deletions Modules/How to enable QuickCasts for Abilities.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
;-----------------------------------------

How to Enable QuickCasts for Abilities in Warcraft III:Reforged.
(Displaced Grid is designed with this functionality in mind)


Step 1.

You MUST use the "GRID" layout.

1. Launch Warcraft III:Reforged
2. Go to "Options"
3. Go to "Input" section
4. In the "Preset Keybindings" select "Grid"
5. Save
6. Exit (!) Warcraft III:Reforged


Step 2.

Open "War3Preferences.txt":

%USERNAME%\Documents\Warcraft III\War3Preferences.txt


Step 3.

In "War3Preferences.txt" change every "QuickCast=0" to "QuickCast=1".

Save "War3Preferences.txt"

Launch Warcraft III:Reforged

;-----------------------------------------
35 changes: 22 additions & 13 deletions Modules/module_Overlay.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
;
;-----------------------------------------

#Include *i %A_ScriptDir%\Modules\Gdip_All.ahk

; Path to the overlay image
Global image_OverlayLayout_Path =
image_OverlayLayout_Path = %A_ScriptDir%\Image_Overlay\IMAGE_OVERLAY.png
Expand Down Expand Up @@ -36,7 +38,6 @@ Control_Overlay(switchTo) {
if (switchTo == 1) {
if WinExist(winTitle) {
SetupImageOverlay() ; yes, every time to resize it just in case, etc
Gui, gui_imageOverlay:Show, NoActivate, % "x" (WarcraftIII_posX) " y" (WarcraftIII_posY)
} else {
MsgBox, %error_warcraftNotFound%
}
Expand All @@ -52,23 +53,31 @@ Control_Overlay(switchTo) {
}
}

SetupImageOverlay() {
color := "FFFFFF"

SetupImageOverlay() {
color := "FFFFFF"

; Get the window handle and position of Warcraft III
WinGet, windowHandle, ID, %winName%
WinGetPos, WarcraftIII_posX, WarcraftIII_posY, WarcraftIII_width, WarcraftIII_height, %winName%

; Add the image with full dimensions of the window
; Show the GUI overlay at the exact position of the Warcraft III window
Gui, gui_imageOverlay:Add, Picture, x0 y0 w%WarcraftIII_width% h%WarcraftIII_height%, %image_OverlayLayout_Path%
Gui, gui_imageOverlay:Show, x%WarcraftIII_posX% y%WarcraftIII_posY% w%WarcraftIII_width% h%WarcraftIII_height%
Gui, gui_imageOverlay:-AlwaysOnTop -Caption +ToolWindow +LastFound -Border +Owner%windowHandle%
; Create a GUI for the overlay with no borders, etc.
Gui, gui_imageOverlay: -Caption +ToolWindow +LastFound -Border +Owner%windowHandle%
Gui, gui_imageOverlay: Color, %color%

Gui, gui_imageOverlay:Color, %color%
; Set the GUI background to be fully transparent
WinSet, TransColor, %color% 255, % gui_imageOverlay

; Make the GUI transparent and click-through
WinSet, TransColor, %color% 250, % gui_imageOverlay ; PNG transparency. 0 = fully transparent
WinSet, ExStyle, +0x20, % gui_imageOverlay ; Click-through
; Set the window as click-through
WinSet, ExStyle, +0x20, % gui_imageOverlay

WinActivate, %winName%
; Add the PNG image to the overlay at the exact size and position of the Warcraft III window
Gui, gui_imageOverlay: Add, Picture, x0 y0 w%WarcraftIII_width% h%WarcraftIII_height%, %image_OverlayLayout_Path%

; Show the GUI overlay without activating it (No Activate)
Gui, gui_imageOverlay: Show, NA x%WarcraftIII_posX% y%WarcraftIII_posY% w%WarcraftIII_width% h%WarcraftIII_height%

; Ensure the Warcraft III window stays in focus
WinActivate, %winName%
}

17 changes: 0 additions & 17 deletions Tutorials/How to enable QuickCasts for Abilities.txt

This file was deleted.

20 changes: 16 additions & 4 deletions _(RUN THIS FILE) Displaced GRID for Warcraft III.ahk
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
;-----------------------------------------
; Displaced GRID+ for Warcraft III by etofok
; Displaced Grid for Warcraft III:Reforged by etofok
; Website Overview: https://etofok.github.io/Displaced-Grid-for-Warcraft-III/web/index
; Download Latest: https://github.com/etofok/Displaced-Grid-for-Warcraft-III

; Development:
; Dec 10th, 2023 - Sept 3rd, 2024
; Dec 10th, 2023 - Sept 5th, 2024
;-----------------------------------------

#SingleInstance force
Expand All @@ -12,7 +14,7 @@
if not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%"

Global currentVersion := "v1.3.0"
Global currentVersion := "v1.3.2"
Global winTitle := "ahk_class OsWindow" ; Warcraft III class name, as seen in WindowSpy of AutoHotkey
Global winName := "Warcraft III" ; Warcraft III window name, as seen in WindowSpy of AutoHotkey

Expand Down Expand Up @@ -120,6 +122,7 @@ Menu, Tray, Add, ,
Menu, Tray, Add, Tutorials, handler_blank
Menu, Tray, Disable, Tutorials
Menu, Tray, Add, How to enable QuickCast for Abilities, Tutorial_AbilityQuickCast
Menu, Tray, Add, How to align the overlay, Tutorial_Overlay
Menu, Tray, Add, Go to Website, Tutorial_Website
Menu, Tray, Add, ,

Expand Down Expand Up @@ -248,7 +251,16 @@ ReloadHotkeys() {

Tutorial_AbilityQuickCast:
Suspend, Permit
Run, %a_scriptdir%\Tutorials\How to enable QuickCasts for Abilities.txt
Run, %a_scriptdir%\Modules\How to enable QuickCasts for Abilities.txt
return

;--------------------------------
; Tutorial_Overlay
;--------------------------------

Tutorial_Overlay:
Suspend, Permit
Run, %a_scriptdir%\Image_Overlay\How to align the overlay to your resolution.txt
return

;--------------------------------
Expand Down
55 changes: 30 additions & 25 deletions _UserSettings.ahk
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
;-----------------------------------------
; Welcome to UserSetting!
; Welcome to UserSettings!
; Please set aside 5 minutes to set up everything once and for all.
;-----------------------------------------



;-----------------------------------------
; How to enable QuickCasts for Abilities in Warcraft III: Reforged.
;
; (!) How to enable QuickCasts for Abilities in Warcraft III:Reforged.
; Displaced Grid is designed with this functionality in mind.
;
; Step 1. You MUST use the 'GRID' layout.
Expand Down Expand Up @@ -38,8 +39,8 @@ Global b_DisplacedGrid := True ; True / False
; 2. What hotkeys do you want to control the app with?
;-----------------------------------------

Hotkey_Toggle_DisplacedGrid = ScrollLock ; Hotswitch between Displaced Grid and Default hotkeys.
Hotkey_ScriptReload = ^Numpad3 ; Reload Script
Hotkey_Toggle_DisplacedGrid = ScrollLock ; Hotswitch between Displaced Grid and Default hotkeys. You need this in order to type in game chats.
Hotkey_ScriptReload = ^Numpad3 ; Reload Script. Default is CTRL+Numpad3

; ^ - CTRL
; + - SHIFT
Expand All @@ -55,22 +56,22 @@ Hotkey_ScriptReload = ^Numpad3 ; Reload Script
; If set to 'False' - the module WILL NOT be loaded.
;-----------------------------------------

Global b_QuickCastItems := True ; Pseudo QuickCast for Items (requires precise coordinates, see below)
Global b_QuickCastItems := True ; Pseudo QuickCast for Items (requires precise pixel coordinates, see below)
Global b_RapidFire := True ; RapidFire Casting: Hold Command
Global b_ShiftQueueItems := True ; Queue items by holding shift
Global b_AltKeyImprovements := True ; Hold Alt to Self Cast + Alt doesn't block from casting abilities
Global b_CommandMultipleGroups := True ; Command Multiple Groups (defaults ASZX, see below)
Global b_CameraHotkeys := True ; Instant Camera Jump for certain groups (defaults f1 f2 f3 f4, see below)
Global b_QuickDropItems := True ; Alt + Ctrl + q/w/a/s/z/x to drop/pass items to mouse cursor (requires precise coordinates, see below)
Global b_ShiftQueueItems := True ; Queue items by holding SHIFT
Global b_AltKeyImprovements := True ; Hold ALT to Self Cast. Holding ALT no longer block commands.
Global b_CommandMultipleGroups := True ; Command Multiple Groups (defaults 'A', 'S', 'Z' and 'X', see below)
Global b_CameraHotkeys := True ; Instant Camera Jump for certain groups (defaults 'F1', 'F2', 'F3' and 'F4', see below)
Global b_QuickDropItems := True ; ALT + CTRL + q/w/a/s/z/x to drop/pass items to mouse cursor (requires precise pixel coordinates, see below)

Global b_EventLog := False ; This is a debugging overlay I used in development.
Global b_EventLog := False ; This is a debugging overlay used in development.



;-----------------------------------------
; 4. What control groups you would like to have an instant camera pan? / 'Camera Hotkeys' Module Set Up
; 4. To which control groups would you like to attach the instant camera pan functionality? | 'Camera Hotkeys' Module Set Up
;
; The defaults in Displaced Grid are the control groups 7,8,9 and 0 (which are bound to f1 f2 f3 f4).
; The defaults in Displaced Grid are the control groups 7,8,9 and 0 (which are bound to F1 F2 F3 and F4).
; These are VALID control groups.
; The module double-taps the group when you tap it, that's why the camera instantly pans.
;-----------------------------------------
Expand All @@ -87,17 +88,17 @@ ControlGroup9.jumpCameraInstantly := True ; f3
ControlGroup0.jumpCameraInstantly := True ; f4

; I found two main use cases:
; a scout / harass / hit-squad
; Main Base / Expansion
; Instant camera pan to a scout or a hit-squad
; Instant camera pan between your Main Base and Expansion



;-----------------------------------------
; 5. What control groups you would like to control at the same time by using CapsLock? / 'Command Multiple Groups' Module Set Up
; 5. Which control groups would you like to manage simultaneously using CapsLock? | 'Command Multiple Groups' Module Set Up
;
; This module allow you send your attack/move/cast/stop/hold/patrol commands to the designated control groups.
; This module allow the user to send attack/move/cast/stop/hold/patrol commands to specific control groups.
;
; I recommend using CG1 CG2 CG3 CG4 as your main 'army' hotkeys (which are bound to A S Z X).
; I recommend using CG1 CG2 CG3 CG4 as your main 'army' hotkeys (which are bound to 'A', 'S', 'Z' and 'X').
; I recommend using CG5 or CG6 as your 'production' hotkey (which are bound to Q and W respectively).
;-----------------------------------------

Expand All @@ -115,12 +116,12 @@ ControlGroup0.commandThisGroup := False ; f4


;-----------------------------------------
; 6. Where is your Portrait UI element on YOUR screen?
; 6. Where is the Portrait UI element located on your screen?
;
; This is required for the Alt Cast module in order to click the Portrait UI element.
; Otherwise this module will not work.
; This is required for the "Alt Cast" module in order to click the Portrait UI element.
; Otherwise this module will not work properly.
;
; You can easily check the coordinates in Windows Paint, like so:
; You can easily check the coordinates in Windows Paint (see in the bottom-left), like so:
; https://etofok.github.io/Displaced-Grid-for-Warcraft-III/web/assets/images/pixelhuntsetup.mp4
;-----------------------------------------

Expand All @@ -131,14 +132,18 @@ PortraitUI.y := 900


;-----------------------------------------
; 7. Where is your Inventory/Backpack UI on YOUR screen?
; 7. Where is the Inventory/Backpack UI element located on your screen?
;
; This is required for the QuickCastItem module, because we pixel hunt whether the item is on cooldown or not (by its blue cooldown overlay).
; This is required for the QuickDropItem module, because we right-click the item in order to grab-and-drag it.
; Otherwise these two modules will not work.
; Otherwise these two modules will not work properly.
;
; You can easily check the coordinates in Windows Paint, like so:
; You can easily check the coordinates in Windows Paint (see in the bottom-left), like so:
; https://etofok.github.io/Displaced-Grid-for-Warcraft-III/web/assets/images/pixelhuntsetup.mp4
;
; We are looking for the blue overlay on top of the item border. Just one pixel.
;
; This way we can determine whether or not the item slot contains an item (by its silver-colored border), and we also can determine whether or not the item is on cooldown (by the blue overlay).
;-----------------------------------------

; The following works for 1920x1080
Expand Down

0 comments on commit 423906d

Please sign in to comment.