Stumble Guys Self Playing AI (Randomized)

Post gaming related scripts
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

Stumble Guys Self Playing AI (Randomized)

Post by Kenzis » 18 Jun 2023, 07:26

This is a simple AHK script for Stumble Guys, Basically, all you have to do is Press F3, and AI will play instead of you. You can earn points for just playing and losing.
The movement is completely randomized, if Stumble Guys was ever to get an anti-cheat, you would not get detected, so don't worry, but you'd probably have to compile the script.
(You could tweak some things and make it even more randomized, but i think it's fine)


*Important* Use the configuration below, or the script won't work.
1920x1080 Resolution,
Stumble Guys set to Fullscreen Mode maximized so it fills the screen


*Config keys*
F3 to start the AI
F1 to quit the script.
You can also close the script by pressing the X button on the top right of your screen.


Mentions and problems:
In future if the script doesn't work, it's because the colors for the ingame buttons for play and leave have been changed, PM me about them and i can change them myself, or if you don't wan't my help, you can find them out yourself using
WindowSpy, and checking what the color of the button is, and replace that hex code inside the script with the new hex color.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetBatchLines, -1
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
#SingleInstance Force
#NoTrayIcon

;Gui button to close the script, initally at the top right of the screen
Gui, New, -border -sysmenu -Caption
Gui, Add, Button, x0 y0 gQuitTheApp, X
Gui, Show, x1900 y2 w22 h22
Gui,+AlwaysOnTop
 
; Config
Forward := "W"
Back := "Space"
Left := "A"
Right := "D"
PlayExistance := False
LeaveExistance := False

; To start the script, be in the main menu and press F3; you can change this hotkey to anything you want, default is F3, Change both F3's that you see here.

F3::
    HotKey, F3, Off
	 
    ; Activate the timer to press click on claim every now and then.
    SetTimer, Start, 0
    SetTimer, PressClaimeverynowandthen__, 4000
    SetTimer, RandomJump, 1000
    return

Beggining:
    PlayExistCheck()
    if PlayExistance = True
    {
        Click, 1548, 944
        PlayExist := False
        Goto, Start
    }
    return

; Looping position of the script, it never really moves from here.
Start:
{
    DelayRandom()
    Sleep, %randomdelay%
    Randomizekey()
    Randomizetime(700, 4000)
    Move(key, randomtime)
    LeaveExistCheck()
    if LeaveExistance = True
    {
        Click, 57, 985
        LeaveExistance := False
    }
    PlayExistCheck()
    if PlayExistance = True
    {
        Click, 1548, 944
        PlayExistance := False
    }
}
return

RandomJump:
{
    Random, jumpy, 0, 200
    Sleep, %jumpy%
    SendInput, {%Back% Down}
    Sleep, 10
    SendInput, {%Back% Up}
    return
}

; Presses the same coordinate for Play under the timer
PressClaimeverynowandthen__:
{
    Click, 1548, 944
    Sleep, 10
    Click, 869, 733
    return
}

; Move function.
Move(key, time)
{
    SendInput, {%key% Down}
    Sleep, %time%
    SendInput, {%key% Up}
    return
}

; Function to randomize keys
RandomizeKey()
{
    Global Back
    Global Forward
    Global key
    Global Left
    Global Right
    Random, randomkey, 1, 6
    if randomkey = 1
        key := Forward
    if randomkey = 2
        key := Back
    if randomkey = 3
        key := Left
    if randomkey = 4
        key := Right
    if randomkey = 5
        key := Forward
    if randomkey = 6
        key := Forward
    return
}

; Function to randomize time, used for sleep command
RandomizeTime(timemin, timemax)
{
    Global randomtime
    Random, randomtime, %timemin%, %timemax%
    return
}

; Delay before start of play, randomized
DelayRandom()
{
    Global randomdelay
    Random, randomdelay, 0, 300
    return
}

; Check if the play button is on the screen
PlayExistCheck()
{
    Global PlayExistance
    Global playexist
    PixelGetColor, playexist, 1548, 944, RGB
    if playexist = 0xFFC616
    {
        PlayExistance := True
		Return
    }
    return
}

; RGB Value was a problem before when it wasn't detecting the colors right. So i added, RGB and it works.
; Check if the leave button is on the screen
LeaveExistCheck()
{
    Global LeaveExistance
    Global leaveexist
    PixelGetColor, leaveexist, 57, 985,  RGB
    if leaveexist = 0xF74E3C
    {
	    Click, 57, 985
        LeaveExistance := True
		Return
    }
    return
}

; Quit the program, You may also change this hotkey to anything you want, Just change F1 and replace it with the hotkey you want.
F1::
QuitTheApp:
ExitApp

[Mod action: Topic moved to gaming section.]

Return to “Gaming Scripts (v1)”