Now this tutorial will be very minimal as i cant post images or anything to help you along yet.
In this tutorial we will be making a simple autopotion for a game.
You will need to download AHK if you done have it already (Mod please add link to AHK's website as i cant)
Step 1:
You will need to run the AutoIt3 Window Spy that comes with the AHK package or download it seperately if for some reason it didnt come with AHK.
Step 2:
- Go into your game and make sure you have a full hp bar.
- Put the cursor over the spot on the hp bar where you would like the potion to activate at.
- Look in window spy and write down the information for that position.
Example
Code:
In Active Window: 1680, 449
Color: 0xF0F0CE (Blue=F0 Green=F0 Red=CE)
Step 3:
In a new script we will use PixelGetColor, OutputVar, X, Y, COLOR to detect when our hp bar falls below the point you chose earlier.
Example:
Code:
PixelGetColor, HPBAR, 1680, 499, 0xF0F0CE
Step 4:
Now that we have the code looking for that pixel lets do something with it when it changes. Put your potion on your hotbar. For this tutorial we will assume the potion is assigned to the "2" hotkey in game.
Example:
Code:
if HPBAR >< 0xF0F0CE
{
send {2 down};Sends the 2 key down
sleep 25 ;Adds a delay because some games ignore input if it doesnt have one
send {2 up} ;Sends the 2 key up
sleep 1000 ;Delays the next key send for 1 seconds
}
Step 5:
Add a trigger.
This step is completely up to you, you can trigger this is probably 100 different ways but for this tutorial we will loop it and assign it to the hotkey numberpad 4
Code:
loop{
PixelGetColor, HPBAR, 1680, 499, 0xF0F0CE
if HPBAR >< 0xF0F0CE
{
send {2 down};Sends the 2 key down
sleep 25 ;Adds a delay because some games ignore input if it doesnt have one
send {2 up} ;Sends the 2 key up
sleep 1000 ;Delays the next key send for 1 seconds
}
}
numpad4::
Pause
return
Hopefully you found this useful and helpful. Ill gladly answer any questions you may have.