Packet based Autopotter is imo to slow. Memory based is much better.
The easierst way would be to put the pot into the bar on a hotkey. Like '1' or something. And if you low hp, you press the 1 key. But it's slow too.
The best way, would be like you already said, to call the function.
We have a few tutorials about calling functions:

It's not so easy to find the functions. You need a point where you can start with it. For example you search for the value of pots you have and try to find the function that uses them.