Skip to content

Instantly share code, notes, and snippets.

@tropicbliss
Created January 3, 2022 14:16
Show Gist options
  • Save tropicbliss/6b5b60ff0cf26e69eee8fea0942fef4e to your computer and use it in GitHub Desktop.
Save tropicbliss/6b5b60ff0cf26e69eee8fea0942fef4e to your computer and use it in GitHub Desktop.
Hypixel Skyblock Melody Harp Macro
import sys
import time
import pyautogui
mapping = {"1": (1, 2), "2": (1, 2), "3": (1, 2), "4": (
1, 2), "5": (1, 2), "6": (1, 2), "7": (1, 2)}
pause_delay = 1
with open("sheet.txt", 'r') as file:
text = file.read().rstrip()
dialog = pyautogui.confirm("Shall we start?")
if dialog == "Cancel":
sys.exit()
for char in text:
if char in mapping:
position = mapping[char]
pyautogui.moveTo(position)
pyautogui.typewrite("q")
elif not char == '.':
print("Unexpected character found, exiting...")
sys.exit(1)
time.sleep(pause_delay)
@AstriB0t
Copy link

I added the other songs and added a calibration/hotkey configuration.
Please note that the files must be in a 'songs/' folder, and have the .txt extension

01HymnToTheJoy.txt

3.3.4.5.5.4.3.2.1.1.2.3.3..22..3.3.4.5.5.4.3.2.1.1.2.3.2..11
0.1484

02FrereJacques.txt

2..3..4..2..2..3..4..2...4..5..6....4..5..6....6.7.6.5.4...2...6.7.6.5.4..2..2..1..2...2..1..2
0.0484

03AmazingGrace.txt

1..3..3...5.4.3.5...4..3...2..1...1..3..3...5.4.3.5...4..6..6....4..6..6...5.4.3.5....4..3...2.1....1..3..3...5.4.3.5...4..3
0.0484

04BrahmsLullaby.txt

1.1.3...1.1.3...1.3.6..5..4.4..3...1.2.3..1..1.2.3...1.3.6.5.4..6..7
0.0484

05HappyBirthdayToYou.txt

1.12..1..3..2....1.12..1..4..3....1..1.6..5..4..3.2....5.54..2..3..2
0.0484

06Greensleeves.txt

3.4..5.6..76.5..4.3..23.4..3.3.23.4..2.1..3.4..5.6..76.5..4.2..34.5..43.2..12.3
0.0484

07Geometry.txt

3.5.3.1.3.5.3...3.5.3.5.765432.2.5.3.1.3.5.3..7.65.43.2.1
0.0984

08Minuet.txt

6.23456.2.2.7.34567.2.2.5.65434.54323.43212
0.0484

09JoyToTheWorld.txt

7.6.54..4.3.21..45..56..67..77654.44321357
0.0484

10GodlyImagination.txt

3.7.2.3.7.2.3.7.2.3.7.2..1.3.5..1.2.5..1.3.6.767676.5.2.3.4..6.7.5..4.3.2.323232.1
0.0484

11LaVieEnRose.txt

6..54.32.65..43.21.54..32.12.54..3...7..65.43.65..43.21.54..32.12.54...3...6..54.32.65..43.21.54..32..1.55...6.6..56.6..56.6..52...6.6..56.6..56.6..57.4..6.1..5654.32.65.1..43.21.54.34.56
0.0484

12ThroughTheCampfire.txt

23423453645345432342345364534543234234536453454323423453645345432342345364534543234234536453457656545434323213.13.1313313.1316.36.3636636.3635.25.2525525.2432321.3.13.1313313.1316.36.3636736.3635.25.2525525.2432321.27
0.0484

13Pachelbel.txt

6...4...5...2...3...1...3...4...4.3.4.1.1...3..4..5..6..6.7.6.5.4.7.6.5.4.3.2.1.3.3.432..6.456.45612345676.234.23454346563.654.32321234564.656.32345676.456.54534565434.234.4567656.5453.543.32321234564.656.32345674
0.0484
import sys
import os
import time
import pyautogui
import keyboard

# change this string depending on your 'drop item' hotkey
DROP_KEY = "a"

# In the case that your mouse doesnt click the right coords (you may jsut be using a diff gui scale in mc)...
# but you can use a tool like MPos-v.0.5.0 that displays your live mouse coords to get better coords for the following
mapping = {"1": (848, 500), "2": (887, 501), "3": (922, 499), "4": (961, 502), "5": (996, 498), "6": (1036, 501), "7": (1068, 500)}
# this delay is in between all actions, if needed, change it in 0.0002 increments
# pause_delay = 0.0484

def calibrate():
    pyautogui.alert("using the incoming tool, get the location of the first and last notes, the program is then going to ask for them.")
    pyautogui.mouseInfo()
    y = int(pyautogui.prompt('y coord ?'))
    x1 = int(pyautogui.prompt('x1 coord ?'))
    x2 = int(pyautogui.prompt('x2 coord ?'))
    step = (x2-x1)//6
    global mapping
    mapping = {str(i+1): (x1+i*step, y) for i in range(0,7)}

def drop_key():
    global DROP_KEY
    DROP_KEY = pyautogui.prompt("what is your drop hotkey?")

# Function to terminate the script
def terminate_script():
    global terminate_flag
    print("Script terminated by user.")
    terminate_flag = True

# Register the '=' key to terminate the script (you can change this)
keyboard.add_hotkey('=', terminate_script)

while True:
    # Prompt the user to choose the song   
    sheet_choice = pyautogui.confirm("Choose a song:", buttons=[file[:-4] for file in os.listdir("./songs/")] + ["❌ Cancel", "🔍 Calibrate", "🔤 Drop Key"])
    if sheet_choice == "❌ Cancel" or sheet_choice == None:
        sys.exit()
    if sheet_choice == "🔍 Calibrate":
        calibrate()
        continue
    if sheet_choice == "🔤 Drop Key":
        drop_key()
        continue
    
    sheet_filename = f"songs/{sheet_choice}.txt"

    with open(sheet_filename, 'r') as file:
        text, pause_delay = map(str.strip, file.read().splitlines())
        pause_delay = float(pause_delay)

    # Flag to indicate if the script should be terminated
    terminate_flag = False

    # change this to add more time between macro start and song start
    time.sleep(3.4)

    for char in text:
        if terminate_flag:
            print("Script terminated.")
            break
        
        if char in mapping:
            position = mapping[char]
            pyautogui.moveTo(position)
            pyautogui.typewrite(DROP_KEY)
        elif char == '.':
            time.sleep(0.2)
        else:
            print(f"Unexpected character found: {char}, exiting...")
            sys.exit(1)
        time.sleep(pause_delay)

@AlextrazaaV1
Copy link

Palu + ratio

@parkerhemming
Copy link

@AstriB0t☝🏻☝🏻👏🏻

@parkerhemming
Copy link

If you’re reading this hypixel devs, fix your game, we don’t want to macro.

@WaffleMaker784
Copy link

How am I supposed to use this? The code flashes a cmd window and just stops. am I missing something?

@tropicbliss
Copy link
Author

Okay if anyone is reading this, you need good ping to use this. I wouldn't recommend using this in the current state

@gercosta
Copy link

gercosta commented Feb 8, 2025

How should one use this without any code knowledge?

@CodeBySumant
Copy link

@AstriB0t
Man Do I have to put this code in main scr and make mod.jar or inject it ? like dll

@Potatoes9411
Copy link

bro you are slow its something called a python script bud

@Tamas162
Copy link

thank you so much i have all songs 100% niw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment