Skip to content
The Chat Archive
gpt-4o-2024-08-06· OpenAI WildChat-4.8M (AI2)

Using Autohotkeys make a script to make my character left click in a game running on…

  1. User

    Using Autohotkeys make a script to make my character left click in a game running on Geforce NOW

  2. Assistant

    To create an AutoHotkey script that can automate left-clicking for a game running on GeForce NOW, you'll need to write a script that simulates mouse clicks. Here’s a basic script to get you started:

    1. Install AutoHotkey: Make sure you have AutoHotkey installed on your system. You can download it from the official website.

    2. Create a New Script: Right-click on your desktop or in a folder, go to New, and select AutoHotkey Script. Name your script file, e.g., AutoClicker.ahk.

    3. Edit the Script: Right-click the script file you just created and select Edit Script. Add the following code to it:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    
    ; Hotkey to start auto-clicking
    F1:: ; Press F1 to start
        toggle := !toggle
        while toggle {
            Click
            Sleep, 100 ; Adjust the delay in milliseconds between clicks
        }
    return
    
    ; Hotkey to stop the script
    F2::ExitApp ; Press F2 to exit
    
    ; Alternatively, you can use the same key to toggle
    F3:: ; Press F3 to toggle on/off
        toggle := !toggle
        return
    
    1. Understand the Script:

      • F1::: Starts the clicking loop when you press F1. You can change this hotkey to whatever you prefer.
      • toggle := !toggle: Toggles the clicking on and off.
      • while toggle { Click ... }: Continuously sends a left mouse click while toggle is true.
      • Sleep, 100: Adds a delay between clicks. Adjust this value to increase or decrease clicking speed.
      • F2::ExitApp: Stops the script when you press F2.
      • F3::: An alternative way to toggle the clicking with a single keypress.
    2. Run the Script: After saving your changes, double-click the script file to run it. You should see an AutoHotkey icon in your system tray, indicating the script is active.

    3. Use the Script: Open your game running in GeForce NOW. Press F1 to start auto-clicking and F2 to stop it.

    Be sure to run the script with appropriate permissions and understand the game's terms of service regarding automation, as automated clicking can sometimes be against the rules in certain games. Adjust the delay and hotkeys to suit your gameplay needs.

  3. User

    The game is running on monitor 2

  4. Assistant

    Running a game on a secondary monitor (monitor 2) with AutoHotkey typically doesn't require additional steps compared to a single-monitor setup because AutoHotkey's mouse commands work based on screen coordinates, which encompass all monitors. However, if you need to ensure your clicks are targeted specifically on monitor 2, you can specify the coordinates where the clicks should occur.

    Here's a revised script to help focus clicks on a specific area that might represent monitor 2. You might need to adjust the coordinates to correspond with your secondary monitor's layout:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    CoordMode, Mouse, Screen  ; Mouse coordinates should be relative to the screen
    
    ; Define the position on monitor 2 where you want clicks to occur
    ; Replace these coordinates with the top-left corner of your game window on monitor 2
    Monitor2X := 1920  ; Change this to the starting X coordinate of monitor 2
    Monitor2Y := 0     ; Change this to the starting Y coordinate of monitor 2
    
    ; Hotkey to start auto-clicking
    F1:: ; Press F1 to start
        toggle := !toggle
        while toggle {
            Click, %Monitor2X%, %Monitor2Y%  ; Click at the specified position
            Sleep, 100  ; Adjust the delay in milliseconds between clicks
        }
    return
    
    ; Hotkey to stop the script
    F2::ExitApp ; Press F2 to exit
    
    ; Alternatively, you can use the same key to toggle
    F3:: ; Press F3 to toggle on/off
        toggle := !toggle
        return
    

    Steps to Use the Script:

    1. Identify Monitor Coordinates: Before running the script, you need to determine where on monitor 2 your game is displayed. You can use a tool like Snipping Tool or the Win+Shift+S shortcut in Windows 10/11 to take a snip and check the coordinates.

    2. Adjust the Coordinates: Set the Monitor2X and Monitor2Y variables to the top-left coordinates of where you want the clicks to occur on Monitor 2. The values 1920, 0 assume you have a standard display setup where the primary monitor is 1920x1080, and the secondary monitor begins right after it.

    3. Save and Run: Save the script with the correct coordinates, and then run it.

    This script configuration assumes a two-monitor setup where the primary monitor (Monitor 1) is 1920x1080 pixels; the secondary monitor starts immediately to the right. Modify Monitor2X and Monitor2Y to match your configuration.

    Note: If your monitors have different resolutions or are arranged differently (e.g., vertically), adjust the coordinates accordingly. Make sure you're familiar with how your monitors are configured in the Windows display settings (Settings -> System -> Display) to get the X, Y starting points right.