About this mod
This macro is designed to automatically play out all 18 holes of the extremely short Shuzz123 map for quick xp farming.
- Permissions and credits
Controls:
- Numpad Multiplication key (*): Mutes only the PGA Tour window and starts the 18-hole loop. On finish, it will unmute the PGA Tour window.
- f4: Closes the script
- Your controls must be set to Keyboard & Mouse (the game doesn't support dynamic input switching)
- It only works for the Shuzz123 map
- You should set your player difficulty to the most difficult settings for the best xp gain
- Your antivirus may flag this macro/script as malicious because it "modifies system settings", or more specifically, it automatically changes the volume setting in the Windows Volume Mixer for the PGA Tour window. They also tend to flag compiled AutoHotkey scripts in general. If you don't trust it, you can build it yourself using AutoHotkey v1 and the source code provided below.
main:
#include CloseScript_GUI.ahk ; add f4 to close script
#include VA.ahk ; add audio library to mute and unmute the window
; functions to mute and unmute a specified window
muteWindow(winName:="a"){
winGet,winPid,PID,% winName
if !(volume:=GetVolumeObject(winPid))
return
VA_ISimpleAudioVolume_SetMasterVolume(volume,0),objRelease(volume)
}
unmuteWindow(winName:="a"){
winGet,winPid,PID,% winName
if !(volume:=GetVolumeObject(winPid))
return
VA_ISimpleAudioVolume_SetMasterVolume(volume,1),objRelease(volume)
}
#IfWinActive, PGA TOUR 2K21
NumpadMult::
muteWindow("PGA TOUR 2K21") ; mute the window while it auto-golfs
Loop, 18
{
; Calculate the center coordinates
xMidScreen := A_ScreenWidth // 2
yMidScreen := A_ScreenHeight // 2
MouseMove, %xMidScreen%, %yMidScreen%, 10
Sleep, 100
Click, Down
Sleep, 100
Click, Up
Click, Down
MouseMove, 0, 100, 10, R
MouseMove, 0, -300, 10, R
Click, Up
Sleep, 1200
Send, {Space down}
Sleep, 25
Send, {Space up}
Sleep, 1000
Send, {Space down}
Sleep, 25
Send, {Space up}
Sleep, 1500
Send, {Space down}
Sleep, 25
Send, {Space up}
Sleep, 500
}
unmuteWindow("PGA TOUR 2K21")
return
#IfWinActive
f4::
Gui, ClosingScript:New, -Caption, Closing Script
Gui, font, s15 w500 q5, Arial
Gui, Add, Text, vClosingText, Closing Script
Gui, Add, Progress, w200 h15 cBlue vMyProgress, 0
Gui, Show, AutoSize
Loop, 100
{
GuiControl,, MyProgress, +1
Sleep, 20
}
Sleep, 100
Gui, Destroy
ExitApp
return
I used the VA Library and setWindowVol Script by Masonjar13 for making the window volume interactions.