Skip to content

Instantly share code, notes, and snippets.

@NotoriousPyro
Last active September 12, 2024 22:00
Show Gist options
  • Save NotoriousPyro/07e02a56078876aa74da63b03731b21d to your computer and use it in GitHub Desktop.
Save NotoriousPyro/07e02a56078876aa74da63b03731b21d to your computer and use it in GitHub Desktop.
#Requires AutoHotkey v2.0
CoordMode "Pixel", "Window"
CoordMode "Mouse", "Window"
HWNDs := WinGetList("ahk_exe RobloxPlayerBeta.exe")
wantsMimics := true
wantsSecretAgents := false
wantsStarGazers := false
wantsPetLuck := false
; coords
SEARCH_AREA_X := 526
SEARCH_AREA_Y := 236
SEARCH_AREA_X2 := 720
SEARCH_AREA_Y2 := 262
ENCHANT_CLICK_POS_X := 578
ENCHANT_CLICK_POS_Y := 507
THROW_CLICK_POS_X := 713
THROW_CLICK_POS_Y := 715
CHAT_AREA_POS_X := 223
CHAT_AREA_POS_Y := 150
THROW_SCREEN_CLOSE_POS_X := 577
THROW_SCREEN_CLOSE_POS_Y := 698
THROW_SCREEN_CLOSE_POS_X2 := 599
THROW_SCREEN_CLOSE_POS_Y2 := 721
BUY_WINDOW_POS_X := 180
BUY_WINDOW_POS_Y := 140
BUY_WINDOW_POS_X2 := 660
BUY_WINDOW_POS_Y2 := 500
ENCHANT_WINDOW_TITLE_POS_X := 450
ENCHANT_WINDOW_TITLE_POS_Y := 108
ENCHANT_WINDOW_TITLE_POS_X2 := 683
ENCHANT_WINDOW_TITLE_POS_Y2 := 157
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X := 633
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y := 323
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X2 := 635
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y2 := 333
NO_MORE_BOOST_POS_X := 404
NO_MORE_BOOST_POS_Y := 641
; colours
SA_PINK := 0xFF1ACC
SA_ORANGE := 0xFF764A
SA_PINK_GREYED := 0x660855
SA_ORANGE_GREYED := 0x663614
MIMIC_PINK := 0xFA37E8
MIMIC_BLUE := 0x3189FF
MIMIC_PINK_GREYED := 0x64165D
MIMIC_BLUE_GREYED := 0x143C66
STARGAZER_ORANGE := 0xEB7E28
STARGAZER_ORANGE_GREYED := 0x5C310F
PET_LUCK_GREEN := 0x39BB31
PET_LUCK_GREEN_GREYED := 0x195216
UPGRADE_RED := 0xE13836
UPGRADE_RED_GREYED := 0x5A1616
THROW_SCREEN_CLOSE_BUTTON_COLOR := 0x69EA4C
THROW_SCREEN_CLOSE_BUTTON_COLOR_GREYED := 0x2A5E1E
THROW_SCREEN_CLOSED_BUTTON_COLOR := 0xEA4949
THROW_SCREEN_CLOSED_BUTTON_COLOR_GREYED := 0x5E1D1D
ThrowScreenIsOpen(&Px, &Py) {
Return PixelSearch(
&Px,
&Py,
THROW_SCREEN_CLOSE_POS_X,
THROW_SCREEN_CLOSE_POS_Y,
THROW_SCREEN_CLOSE_POS_X2,
THROW_SCREEN_CLOSE_POS_Y2,
THROW_SCREEN_CLOSE_BUTTON_COLOR,
5
) OR PixelSearch(
&Px,
&Py,
THROW_SCREEN_CLOSE_POS_X,
THROW_SCREEN_CLOSE_POS_Y,
THROW_SCREEN_CLOSE_POS_X2,
THROW_SCREEN_CLOSE_POS_Y2,
THROW_SCREEN_CLOSE_BUTTON_COLOR_GREYED,
5
) ;
}
ThrowingWithClosedThrowScreen() {
Return PixelSearch(
&Px,
&Py,
THROW_SCREEN_CLOSE_POS_X,
THROW_SCREEN_CLOSE_POS_Y,
THROW_SCREEN_CLOSE_POS_X2,
THROW_SCREEN_CLOSE_POS_Y2,
THROW_SCREEN_CLOSED_BUTTON_COLOR,
5
) or PixelSearch(
&Px,
&Py,
THROW_SCREEN_CLOSE_POS_X,
THROW_SCREEN_CLOSE_POS_Y,
THROW_SCREEN_CLOSE_POS_X2,
THROW_SCREEN_CLOSE_POS_Y2,
THROW_SCREEN_CLOSED_BUTTON_COLOR_GREYED,
5
) ;
}
NoMoreBoost() {
Return PixelSearch(
&Px,
&Py,
NO_MORE_BOOST_POS_X,
NO_MORE_BOOST_POS_Y,
NO_MORE_BOOST_POS_X + 1,
NO_MORE_BOOST_POS_Y + 1,
0x000000,
0
) ;
}
CloseThrowScreen() {
if ThrowScreenIsOpen(&Px, &Py) {
MouseMove Px, Py ;
Sleep 1 ;
MouseClick "Left", Px, Py + 1 ;
Sleep 1000 ;
}
}
PetMenuIsOpen() {
Return ImageSearch(
&TopLeftFoundImageX,
&TopLeftFoundImageY,
0,
0,
1008,
594,
"pets.png"
) ;
}
OpenPetsMenu() {
if !PetMenuIsOpen() {
MouseMove 884, 427 ;
Sleep 1 ;
MouseClick "Left", 884, 427 + 1 ;
Sleep 1 ;
}
}
ClosePetsMenu() {
if PetMenuIsOpen() {
MouseMove 953, 200 ;
Sleep 1 ;
MouseClick "Left", 953, 200 + 1 ;
Sleep 1 ;
}
}
TeamsMenuIsOpen() {
Return ImageSearch(
&TopLeftFoundImageX,
&TopLeftFoundImageY,
0,
0,
1008,
594,
"*8 create.png"
) ;
}
OpenTeamsMenu() {
if !TeamsMenuIsOpen() {
if ImageSearch(&TopLeftFoundImageX, &TopLeftFoundImageY, 0, 0, 1008, 594, "*8 teams.png") {
MouseMove TopLeftFoundImageX, TopLeftFoundImageY ;
Sleep 1 ;
MouseClick "Left", TopLeftFoundImageX, TopLeftFoundImageY + 1 ;
Sleep 1 ;
}
}
}
GetTeamPos(&Px, &Py, team) {
Return ImageSearch(&Px, &Py, 592, 263, 888, 553, Format("*10 {:}.png", team)) ;
}
selectedTeam := ""
SelectTeam(team) {
global selectedTeam ;
if selectedTeam == team {
Return ;
}
OpenPetsMenu() ;
Sleep 1000 ;
OpenTeamsMenu() ;
Sleep 1000 ;
if GetTeamPos(&Px, &Py, team) {
if PixelSearch(&TopLeftFoundImageX, &TopLeftFoundImageY, Px - 5, Py - 5, 1008, 594, 0x54F350, 5) {
MouseMove TopLeftFoundImageX + 5, TopLeftFoundImageY + 5 ;
Sleep 1 ;
MouseClick "Left", TopLeftFoundImageX + 6, TopLeftFoundImageY + 6 ;
}
}
Sleep 1000 ;
ClosePetsMenu() ;
selectedTeam := team ;
}
EnchantWindowIsOpen(&TopLeftFoundImageX, &TopLeftFoundImageY) {
Return ImageSearch(&TopLeftFoundImageX, &TopLeftFoundImageY, ENCHANT_WINDOW_TITLE_POS_X, ENCHANT_WINDOW_TITLE_POS_Y, ENCHANT_WINDOW_TITLE_POS_X2, ENCHANT_WINDOW_TITLE_POS_Y2, "enchant_window.png") ;
}
BuyWindowIsOpen(&TopLeftFoundImageX, &TopLeftFoundImageY) {
Return ImageSearch(
&TopLeftFoundImageX,
&TopLeftFoundImageY,
BUY_WINDOW_POS_X,
BUY_WINDOW_POS_Y,
BUY_WINDOW_POS_X2,
BUY_WINDOW_POS_Y2,
"cancel.png"
) ;
}
CloseBuyWindow() {
if BuyWindowIsOpen(&TopLeftFoundImageX, &TopLeftFoundImageY) {
MouseMove TopLeftFoundImageX, TopLeftFoundImageY ;
Sleep 10 ;
MouseClick "Left", TopLeftFoundImageX, TopLeftFoundImageY + 1 ;
Sleep 2000 ;
}
}
PetHasEnchantColour(colour) {
Return PixelSearch(&Px, &Py, SEARCH_AREA_X, SEARCH_AREA_Y, SEARCH_AREA_X2, SEARCH_AREA_Y2, colour, 10) ;
}
IsUpgradeScreen() {
Return ImageSearch(
&TopLeftFoundImageX,
&TopLeftFoundImageY,
ENCHANT_WINDOW_TITLE_POS_X,
ENCHANT_WINDOW_TITLE_POS_Y,
ENCHANT_WINDOW_TITLE_POS_X2,
ENCHANT_WINDOW_TITLE_POS_Y2,
"upgrade.png"
) or ImageSearch(
&TopLeftFoundImageX,
&TopLeftFoundImageY,
ENCHANT_WINDOW_TITLE_POS_X,
ENCHANT_WINDOW_TITLE_POS_Y,
ENCHANT_WINDOW_TITLE_POS_X2,
ENCHANT_WINDOW_TITLE_POS_Y2,
"upgrade_grayed.png"
) ;
}
IsEnchantLevel5OrAbove() {
Return PixelSearch(
&Px,
&Py,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X2,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y2,
UPGRADE_RED,
5
) or PixelSearch(
&Px,
&Py,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_X2,
UPGRADE_WINDOW_FAIL_BAR_POS_LEVEL5_Y2,
UPGRADE_RED_GREYED,
5
) ;
}
IsPetLuck() {
Return PetHasEnchantColour(PET_LUCK_GREEN) or PetHasEnchantColour(PET_LUCK_GREEN_GREYED) ;
}
IsMimic() {
Return (
PetHasEnchantColour(MIMIC_PINK) and PetHasEnchantColour(MIMIC_BLUE)
) or (
PetHasEnchantColour(MIMIC_PINK_GREYED) and PetHasEnchantColour(MIMIC_BLUE_GREYED)
) ;
}
IsSecretAgent() {
Return (
PetHasEnchantColour(SA_PINK) and PetHasEnchantColour(SA_ORANGE)
) or (
PetHasEnchantColour(SA_PINK_GREYED) and PetHasEnchantColour(SA_ORANGE_GREYED)
) ;
}
IsStarGazer() {
Return PetHasEnchantColour(STARGAZER_ORANGE) or PetHasEnchantColour(STARGAZER_ORANGE_GREYED) ;
}
IsWantedEnchant()
{
CloseBuyWindow() ;
Return (
wantsSecretAgents and IsSecretAgent()
) or (
wantsMimics and IsMimic()
) or (
wantsStarGazers and IsStarGazer()
) or (
wantsPetLuck and IsPetLuck()
) ;
}
ClickEnchantButton(active_window_id:=0) {
; Safeguard rare enchants
for window_id in HWNDs {
WinActivate "ahk_id" window_id ;
if !IsWantedEnchant() {
MouseMove ENCHANT_CLICK_POS_X, ENCHANT_CLICK_POS_Y ;
Sleep 1 ;
MouseClick "Left", ENCHANT_CLICK_POS_X, ENCHANT_CLICK_POS_Y + 1 ;
Sleep 1 ;
}
}
if active_window_id != 0 {
WinActivate "ahk_id" active_window_id ;
}
Sleep 25 ;
}
ClickUpgradeButton() {
; Safeguard rare enchants
for window_id in HWNDs {
WinActivate "ahk_id" window_id ;
if IsEnchantLevel5OrAbove() {
Continue ;
}
MouseMove ENCHANT_CLICK_POS_X, ENCHANT_CLICK_POS_Y ;
Sleep 1 ;
MouseClick "Left", ENCHANT_CLICK_POS_X, ENCHANT_CLICK_POS_Y + 1 ;
Sleep 1 ;
}
}
Yeet(changeTeams:=false) {
if !ThrowingWithClosedThrowScreen() {
if changeTeams {
SelectTeam("rocket") ;
}
MouseMove THROW_CLICK_POS_X, THROW_CLICK_POS_Y ;
Sleep 10 ;
MouseClick "Left", THROW_CLICK_POS_X, THROW_CLICK_POS_Y + 1 ;
Sleep 1000 ;
CloseThrowScreen() ;
}
}
AutoFarmStarsEnergyAndEnchants(enchant) {
Loop {
for window_id in HWNDs {
WinActivate "ahk_id" window_id ;
if enchant {
ClickEnchantButton(window_id) ;
} else {
if NoMoreBoost() {
SelectTeam("energy") ;
}
else {
SelectTeam("power") ;
}
}
Send "{w down}" ;
Send "{Space down}" ;
Sleep 4000 ;
Send "{Space up}"
Sleep 2000 ;
Send "{w up}" ;
Yeet(!enchant) ;
if enchant {
ClickEnchantButton(window_id) ;
}
else {
if NoMoreBoost() {
SelectTeam("energy") ;
}
else {
SelectTeam("power") ;
}
}
Send "{s down}" ;
Send "{Space down}" ;
Sleep 4000 ;
Send "{Space up}"
Sleep 2000 ;
Send "{s up}" ;
if NoMoreBoost() {
SelectTeam("energy") ;
}
Sleep 25 ;
}
}
}
F2:: {
Pause True ;
Suspend True ;
Reload ;
} ;
F3:: {
Yeet() ;
; if IsWantedEnchant() {
; MsgBox "Detected a rare enchant colour pair" ;
; Return ;
; }
; MsgBox "Did not detect any rare enchant" ;
}
; auto farm stars and energy
F4:: {
AutoFarmStarsEnergyAndEnchants(false) ;
} ;
; auto farm stars, energy, and mimic
F5:: {
AutoFarmStarsEnergyAndEnchants(true) ;
} ;
; auto open eggs quickly
F6:: {
Loop {
for window_id in HWNDs {
WinActivate "ahk_id" window_id ;
if BuyWindowIsOpen(&TopLeftFoundImageX, &TopLeftFoundImageY) {
Continue ;
}
MouseMove CHAT_AREA_POS_X, CHAT_AREA_POS_Y ;
Sleep 10 ;
MouseMove THROW_CLICK_POS_X, THROW_CLICK_POS_Y - 1 ;
Send "{r down}" ;
Sleep 5 ;
Send "{r up}" ;
Loop 20 {
MouseClick "Left", THROW_CLICK_POS_X, THROW_CLICK_POS_Y ;
Sleep 25 ;
}
}
Sleep 500 ;
}
} ;
; Roll for enchants
F7:: {
Loop {
ClickEnchantButton() ;
Sleep 5000 ;
}
} ;
; Upgrade to level 5
F8:: {
if IsEnchantLevel5OrAbove() {
MsgBox "is level 5 or above"
}
} ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment