How to compare a value and execute a key

Posts 1–3 of 3 · Page 1 of 1
How to compare a value and execute a key
Hello, I would like some help with knowing how to compare a value in a game, for example, health. I already have the offset for the health. I want to read this value, and say if it is below 20% of the max value, I would like it to use a health potion, or if it were simpler, just press the key that the health potion is assigned to. I was thinking this should be done with something like AHK, but I don't know how I could read a value and then execute the AHK script. Thanks for your help!
You can use nearly any language with read and write functions even node.js is possible.
There are several ways to do it.


1. Hook a game function wich gets called often enough, and execute your code there.

2. Create a codecave with your own timer, and execute your code.

3. Create a external programm with timer and read the health and then simulate a key press.




Since you aren't in a specific language sub forum you will not likely get any pasta code
Quote Originally Posted by RoPMadM View Post
You can use nearly any language with read and write functions even node.js is possible.
There are several ways to do it.


1. Hook a game function wich gets called often enough, and execute your code there.

2. Create a codecave with your own timer, and execute your code.

3. Create a external programm with timer and read the health and then simulate a key press.




Since you aren't in a specific language sub forum you will not likely get any pasta code
I don't want any pasta code! I'm most fluent with Python and I might actually try to make this with Python. I'll probably go with your third option and read my health and simulate a key press once my health gets low. Thank you! :-)
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us