#๐Ÿ”’ Code Review

9 messages ยท Page 1 of 1 (latest)

icy gate
#

Using pyautogui picture detection

zealous magnetBOT
#

@icy gate

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

icy gate
#
def human_click(input):
    time.sleep(random.uniform(0.1, 0.05))
    pydirectinput.press(input)

def search_cards():
    if pyautogui.locateOnScreen(search, region=(190, 1250, 150, 150), confidence=0.7) is not None:
        return True
    else:
        return False

# region=(820, 750, 350, 350),
def check_search():
    if pyautogui.locateOnScreen(no_results, confidence=0.55) is not None:
        return True
    else:
        return False


def card_counts():
    cards = 0
    region = 567
    while region < 2280:
        if pyautogui.locateOnScreen(card, region=(region, 350, 250, 250), confidence=0.4) is not None:
            cards += 1
            region += 567
        else:
            return cards
    return cards


def buy_card(amt_of_cards):
    for i in range(0, amt_of_cards):
        human_click("space")
        human_click("down")
        human_click("space")
        human_click("down")
        human_click("space")
        while pyautogui.locateOnScreen(loading, region=(2310, 1180, 250, 210), confidence=0.2) is not None:
            sleep(0.1)
        sleep(0.4)
        human_click("esc")
        human_click("d")
    pyautogui.screenshot("snipe.png", region=(0, 0, 2440, 1410))
    requests.post(url, headers=header, data=payload, files=files)
    pydirectinput.press("esc")
    if search_cards():
        return True
    else:
        return False


while not keyboard.is_pressed('l'):
    if pyautogui.locateOnScreen(card, region=(567, 350, 250, 250), confidence=0.7):
        buy_card(card_counts())
    elif search_cards():
        human_click('enter')
    elif check_search():
        human_click('esc')```
#

was wondeing if anyone had ideas or better ways to simplify this or make it a little bit better

#

feel free to ask questions, ect

gray crystal
zealous magnetBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.