POE (Path of Exile) automatic drink potion macro

  • Related Categories: DIY, software

  • Warning

    This posting is for educational purposes only. Never abuse,

     

    2019-06-14 

    The Post uses the Arduino Pro Micro to create the macro. But only Python is possible… If you are looking for Python only, please read this article lightly and follow the link below. 

    POE (Path of Agile) potion automatic eating macro (software)

     

    To do! Life on the room. 

    I made a hardware macro using Arduino Pro Micro postings The other time? Very nice

    Today, I’ll apply that macro to the Gemin Pass of Exeter, which is a fad. 

    I’ll explain how it works first.

    1. How does it work? 

    • After you create a file named Config.cfg, type:
    [portion_drink_delay]
    delay = 0.1
    [portion_key]
    k_f2 = 1,2,3,4,5
    m_right = 5
    m_middle = 4

     

    The Portion_drink_delay section is a time difference between when a hardware macro presses a Key. In other words, if you suppose 1, 2, then press 1 and wait 0.1 seconds to press 2.

    The Portion_key section defines the number keys that are pressed according to specific inputs. 

    For example, K_F2 = 1, 2, 3, 4, 5, pressing F2 on the keyboard means to press 1, 2, 3, 4, 5 keys as a hardware mechs. That is, press F2 to enter 1, 2, 3, 4, 5 as 0.1 second time. 

    K_f2 K means Keyboard, and m_right m means Mouse. 

    For keyboards, most keys are supported and the mouse behaves only left, right, and middle. 

    • Run the code as an administrator, and then Play the path of exo. 

    Let’s look at how the code works.

    2. Code 

    I made a serialFunc.py in the Post?? Create a file named drinkPortion.py in the folder and enter the code below. Oh, and config.cfg file, please.

    import mouse as mo
    import keyboard as keys
    import time
    import serialFunc as sf
    import configparser
    import os
    try:
        ser = sf.ExternalHID('COM16')
    except Exception as e:
        print(e)
        print("Hardware Macro Disabled")
    def generateKeyEvent(val, key_s, delay):
        if val == True:
            for outVal in key_s:
                # hardware macro
                ser.keyboardInput(outVal)
                # software macro
                # keys.press(outVal)
                time.sleep(delay)
    def drinkPortionWithInput(listDevKeyOutVal, delay=0.001):
        listKeyState = [0] * len(listDevKeyOutVal)
        while True:
            for idx, dictDevVal in enumerate(listDevKeyOutVal):
                keyormo = list(dictDevVal.keys())[0]
                generateKeys = dictDevVal[keyormo].split(',')
                # [0] = k is keyboard [1] = pushed key
                if keyormo.split('_')[0].strip() == 'k':
                    value = keys.is_pressed(keyormo.split('_')[1].strip())
                    if listKeyState[idx] != value:
                        generateKeyEvent(value, generateKeys, delay)
                        listKeyState[idx] = value
                # [0] = m is mouse [1] = pushed mouse btn
                elif keyormo.split('_')[0].strip() == 'm':
                    possList = [mo.LEFT, mo.RIGHT, mo.MIDDLE]
                    try:
                        possList.index(keyormo.split('_')[1].strip())
                    except Exception as e:
                        continue
                    value = mo.is_pressed(keyormo.split('_')[1].strip())
                    if listKeyState[idx] != value:
                        generateKeyEvent(value, generateKeys, delay)
                        listKeyState[idx] = value
    if __name__=="__main__":
        configFile = os.path.dirname(os.path.realpath(__file__)) + '\\' + 'config.cfg'
        config = configparser.ConfigParser()
        config.read(configFile)
        itemList = []
        for option in config.options('portion_key'):
            itemList.append({option:config['portion_key'][option]})
        drinkDelay = float(config['portion_drink_delay']['delay'])
        print("macro start drink delay  %s " % str(drinkDelay))
        while True:
            time.sleep(0.001)
            drinkPortionWithInput(itemList, drinkDelay)

     

    In my case, the configuration of the folder in Pycharm is: 

    This way, you can run the code on Pycharm while it’s configured. 

    You must run the Pycharm as an administrator. ~~~~

    Another look at the code is the ExternalHID (‘ COM16 ‘) phrase? Where the COM1 means the serial port number. In other words, you can use the COM port of Arduino Pro Micro. 

    And you have to install the library too! You can install it in CMD with the command below. You can install it in Pycharm. 

    pip install keyboard
    pip install mouse
    pip install configparser

     

    If you run it, you’ll get the phrase below. 

     

    Macro Start drink delay 0.1

    Then turn on POE and press F2 and right button during hunting ~ ~ Then the potion will be eaten automatically. !!



    Subscribe to the Blog!!

    You may also like...

    댓글 남기기

    이메일은 공개되지 않습니다.