#SingleInstance, Force
#MaxThreadsPerHotkey 2

SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen

Global primaryMonitorWidth := 1920   ; Width of primary monitor
Global secondMonitorWidth := 1920    ; Width of second monitor
Global secondMonitorHeight := 1080   ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2)   ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2)   ; Center y of the second monitor

F5::
Goto AFKCTest

F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK

F7::Goto ContinuousEKey

F8::
Goto MetalRun

F9::
Goto StoneRun

F10::
Goto CrystalRun

F11::
Goto WoodRun

F1:: 
Goto Alt

F2::
Goto Main

F3::
Goto Jump

AFKCTest:
AFKCToggle := !AFKCToggle
loop
{
    If not AFKCToggle
        break
    Sleep 150
    ControlClick, x%screencenterx% y%screencentery%, GeForce NOW,,,, D Pos
    ControlClick, x%screencenterx% y%screencentery%, GeForce NOW,,,, U Pos
}
return

GeForceNowAntiAFK:
Gui, Submit, NoHide
SetTimer, GeForceNowAntiAFKLoop, 240000
return

GeForceNowAntiAFKLoop()
{
    WinGetPos, X, Y, Width, Height, GeForce NOW
    if ErrorLevel = 0
    {
        WinMove, GeForce NOW,, X, Y + 1
        Sleep, 333
        WinMove, GeForce NOW,, X, Y
    }
}

ContinuousEKey:
EKeyToggle := !EKeyToggle
Loop
{
    If not EKeyToggle
        break
    Send, e
    Sleep, 150
}
return


MetalRun:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
    Sleep, 450  ; Small delay to ensure activation

    ; Perform actions using Send
    Send, f
    Sleep, 450
    MouseClick, Left, -650, 200
    Sleep, 150
    Send, g
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, R
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, o
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, h
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, f
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    
    Send, {Esc}
    Sleep, 150
    
    MouseClick, Left, 1250, 200

    ; Return to primary monitor and activate "ARK: Ascended"
    primaryMonitorCenterX := 1920 // 2
    primaryMonitorCenterY := 1080 // 2
    MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
    WinActivate, ArkAscended
Return

StoneRun:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
    Sleep, 450  ; Small delay to ensure activation

    ; Perform actions using Send
    Send, f
    Sleep, 400
    MouseClick, Left, -650, 200
    Sleep, 150
    Send, d
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, g
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, h
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    Send, {Esc}
    Sleep, 150
    
    MouseClick, Left, 1250, 200

    ; Return to primary monitor and activate "ARK: Ascended"
    primaryMonitorCenterX := 1920 // 2
    primaryMonitorCenterY := 1080 // 2
    MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
    WinActivate, ArkAscended
Return

CrystalRun:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
    Sleep, 450  ; Small delay to ensure activation

    ; Perform actions using Send
    Send, f
    Sleep, 450
    MouseClick, Left, -650, 200
    Sleep, 150
    Send, E
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, o
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, f
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, h
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150
    
    Send, {Esc}
    Sleep, 150
    
    MouseClick, Left, 1250, 200

    ; Return to primary monitor and activate "ARK: Ascended"
    primaryMonitorCenterX := 1920 // 2
    primaryMonitorCenterY := 1080 // 2
    MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
    WinActivate, ArkAscended
Return

WoodRun:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
    Sleep, 450  ; Small delay to ensure activation

    ; Perform actions using Send
    Send, f
    Sleep, 450
    MouseClick, Left, -650, 200
    Sleep, 150
    Send, R
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    MouseClick, Left, -650, 200
    Sleep, 150
    Send, H
    Sleep, 150
    Send, {Enter}

    MouseClick, Left, -500, 193
    Sleep, 150
    Send, {Enter}
    Sleep, 150

    Send, {Esc}
    Sleep, 150
    
    MouseClick, Left, 1250, 200

    ; Return to primary monitor and activate "ARK: Ascended"
    primaryMonitorCenterX := 1920 // 2
    primaryMonitorCenterY := 1080 // 2
    MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
    WinActivate, ArkAscended
Return

Alt:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
Return

Main:
    ; Activate Main window
	WinActivate, ArkAscended
Return

Jump:
    ; Activate GeForce NOW window
    WinActivate, GeForce NOW                       
    Sleep, 200  ; Small delay to ensure activation

    ; Perform actions using Send
    Send, e
    Sleep, 50  ; Small delay to ensure activation
    ; Return to primary monitor and activate "ARK: Ascended"
    primaryMonitorCenterX := 1920 // 2
    primaryMonitorCenterY := 1080 // 2
    MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
    WinActivate, ArkAscended
Return