I am using the AutoHotKey program and I have a script that monitors a certain pixel and it's color, and if it changes it will do something to make the color go back. So let's say it is looking at the pixel 100, 100 and the color is 0xFFFFFF, if the color changes to anything other than 0xFFFFFF the script will hit the number 5 key and it will go back to 0xFFFFFF. This works perfectly, now what I am here for is some help in getting one script to monitor TWO x,y positions and TWO separate colors, and using TWO different keys to change said colors back to the monitored color. This script is mainly used for playing online computer games like Ragnarok Online or WoW.
Here is the code for monitoring the ONE x,y and ONE color
#Persistent
CoordMode, Pixel, Relative
X := 100
Y := 100
SetColor := 0xC48559
SetTimer, WatchLife, 100
Return
WatchLife:
Pixelgetcolor, Color, %X%, %Y%
if (Color = SetColor)
Return
Else
Send, 5
Sleep 20
Return
This script watches the HP bar and it get's below a certain area it will automatically press the number 5 key to use a HP Potion to get the HP bar back up. This helps gamers a lot so they don't have to pay that much attention to their HP and focus more on attacking a player or a monster.
Now I need a way to have one script that does this twice, the AutoHotKey program doesn't allow some lines to be repeated so you can't just copy paste this twice in one script, and yes you can use this script twice by changing the x,y's and color code, but having more than one script running at a time can mess with other scripts, I'v seen this happen and has happend to me a few times while running this script with another script.
I have tried this code;
#Persistent
CoordMode, Pixel, Relative
X := 100
Y := 100
SetColor := 0xC48559
X := 100
Y := 80
SetColor := 0xF0DED7
SetTimer, WatchLife, 100
Return
WatchLife:
Pixelgetcolor, 0xC48559, 100, 100
if (Color = SetColor)
Return
Else
Send, 5
Sleep 20
Pixelgetcolor, 0xF0DED7, 100, 80
if (Color = SetColor)
Return
Else
Send, 6
Sleep 20
Return
I would assume this would work but it just spams the keys for the healing items of both HP and MP when the color in the pixel is there. I have searched on the main website and on the forums of AutoHotKey but I haven't seen anything about having this script.
Please help, this script would help out anyone who plays any online computer game that is similar to WoW or Ragnarok Online.