Where do i put hex code of player outline? and is there anything else i need to do

Ask gaming related questions (AHK v1.1 and older)
Wooflust
Posts: 2
Joined: 11 Feb 2024, 12:16

Where do i put hex code of player outline? and is there anything else i need to do

11 Feb 2024, 12:19

Code: Select all

; AutoHotkey Script

; Function: ColorTriggerbot
; Description: Creates a color triggerbot for the specified color code
; Parameters:
;   - colorCode: The color code to trigger on (in hexadecimal format)
; Return: None
ColorTriggerbot(colorCode)
{
    ; Set the color code to trigger on
    SetColorTrigger(colorCode)

    ; Loop indefinitely
    while true
    {
        ; Get the color of the pixel under the mouse cursor
        pixelColor := GetPixelColor()

        ; Check if the pixel color matches the trigger color
        if (pixelColor = colorCode)
        {
            ; Perform the trigger action (e.g. click, press a key, etc.)
            PerformTriggerAction()
        }

        ; Sleep for a short moment to avoid excessive CPU usage
        Sleep, 10
    }
}

; Function: SetColorTrigger
; Description: Sets the color code to trigger on
; Parameters:
;   - colorCode: The color code to trigger on (in hexadecimal format)
; Return: None
SetColorTrigger(colorCode)
{
    ; Store the color code in a global variable for later use
    global triggerColorCode := colorCode
}

; Function: GetPixelColor
; Description: Retrieves the color of the pixel under the mouse cursor
; Parameters: None
; Return: The color code of the pixel (in hexadecimal format)
GetPixelColor()
{
    ; Get the screen coordinates of the mouse cursor
    MouseGetPos, mouseX, mouseY

    ; Use the PixelGetColor function to retrieve the color of the pixel
    pixelColor := PixelGetColor(mouseX, mouseY)

    ; Convert the pixel color to hexadecimal format
    pixelColor := "0x" . Format("{:06X}", pixelColor)

    ; Return the pixel color
    return pixelColor
}

; Function: PerformTriggerAction
; Description: Performs the trigger action when the color code matches
; Parameters: None
; Return: None
PerformTriggerAction()
{
    ; Add your trigger action code here
    ; For example, you can simulate a mouse click using the Click function:
    ; Click
}

; Usage example:
ColorTriggerbot(0xe600e6)

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod action: Topic moved from "Ask for Help (v2)" to "Gaming Help (v1)" since this is v1 code and it's for a game. Please post in the correct sub-forum in the future.]
User avatar
boiler
Posts: 17129
Joined: 21 Dec 2014, 02:44

Re: Where do i put hex code of player outline? and is there anything else i need to do

11 Feb 2024, 12:31

The very last line of the code is where it calls the ColorTriggerbot() function and passes it the color code. You would also need to add whatever actions you want it to take in the PerformTriggerAction() function right above that, as the comments indicate.
Wooflust
Posts: 2
Joined: 11 Feb 2024, 12:16

Re: Where do i put hex code of player outline? and is there anything else i need to do

11 Feb 2024, 12:33

do i need to remove the semicolon in ;click
User avatar
boiler
Posts: 17129
Joined: 21 Dec 2014, 02:44

Re: Where do i put hex code of player outline? and is there anything else i need to do

11 Feb 2024, 12:35

Yes, if that's what you want it to do. You can put any code there you want to execute it. The semicolon indeed "comments it out", so you would remove it to have that line be executed.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Performance and 18 guests