Hi there,
I've seen a few post across the internet about something called pixelsearch / pixelgetcolor or something similar and I would like to be able to utilize something like that myself.
I play a game called World of Warcraft and I would like to be able to "track" the health of the party members, however I do not wish to automate alot of actions just that when health reaches, say 50% I would like it to send a key or two.
So what I had in mind is, when I press a key it checks if health bar or bars (if playing in group) is ok, if not. It will send a key.
Now for someone with no knowledge, how do I go about to do something like this? Perhaps a visual and audio explanation or a workable script I could read through?
To recap: Track health, if health is low -> send a keybind.
Below is a screenshot of my health bars if thats to any help.
Best regards
Healing script
Healing script
- Attachments
-
- Healthbar.jpg (688.12 KiB) Viewed 3594 times
Re: Healing script
Yea I guess that's possible. I can't give you a visual/audio explanation or anything but I will try my best haha.
But I have a question. Are their healthbars static (don't move from time to time) if not that can be a problem. And are they always the same? Like some games can have different amounts of people so in that case there will be fewer or more healthbars. I guess it's still possible but only if you can predict where their healthbars will be when you know how many people are playing. Otherwise I can't help you that's complex.
But I have a question. Are their healthbars static (don't move from time to time) if not that can be a problem. And are they always the same? Like some games can have different amounts of people so in that case there will be fewer or more healthbars. I guess it's still possible but only if you can predict where their healthbars will be when you know how many people are playing. Otherwise I can't help you that's complex.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
Where it says Danicus Dreyel etc those are static as in they dont move, but as the hp decreases the health bar becomes less full per character. It Danicus loses 50% hp THE bar is half full.
Does that make any sense?
Thanks for helping
Does that make any sense?
Thanks for helping
Re: Healing script
I'm asking whether the health bar, for example, moves when the character moves? Is the health bar attached to the character or is it separately visible in your screen?gsboxing wrote:Where it says Danicus Dreyel etc those are static as in they dont move, but as the hp decreases the health bar becomes less full per character. It Danicus loses 50% hp THE bar is half full.
Does that make any sense?
Thanks for helping
Can you please try and take a screenshot in your game? Tt might help me understand.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
You can see a screenshot in the attachment. THE healthbar doesnt move at all.
Danicus 100%
Dreyel 100%
Krenn 100%
Etc those are the healthbar i want to track.
Best regards
Danicus 100%
Dreyel 100%
Krenn 100%
Etc those are the healthbar i want to track.
Best regards
Re: Healing script
Okay that's good. So there are always 3 healthbars in exact locations? And you want to monitor these health bars?
And the healthbars change in color when the hp reduces?
So when you click the hotkey you want to know whether or not the players have more than 50% hitpoints? Or do you want more like 25% 50% 75%?
I'm not an ahk pro but I'll try to help hehe. This might take several attempts but hey if it's worth it right.
My next reply might be tomorrow. Just wanted to let you know.
And the healthbars change in color when the hp reduces?
So when you click the hotkey you want to know whether or not the players have more than 50% hitpoints? Or do you want more like 25% 50% 75%?
I'm not an ahk pro but I'll try to help hehe. This might take several attempts but hey if it's worth it right.
My next reply might be tomorrow. Just wanted to let you know.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
Í would like to track all 5, if having 25 50 75 doesnt complicate the script too much that would be great
Ill póst a screenshot tonight to show how it looks when health is low.
Thanks for helping:)
Ill póst a screenshot tonight to show how it looks when health is low.
Thanks for helping:)
Re: Healing script
Okay let's do the 50% first. Ok I need a favor from you.
You have to run this script when you're playing the game.
This is for me to get the values of the coordinates when the healthbar is below 50% and the color of the healthbar of course.
So here is what I want you to do:
Enter the game so you have the healthbars displaying, now press Ctrl+S to start the script.
Move your mouse on top of the healthbar (any of them) and click the button 'c'. This is for the color.
And now is the tricky part. I want you to move your mouse over on the healthbar making sure that you are approximately half way of the healthbar and just a few pixels left. (As you can see I'm not below 50% in the attachment but you get the point, I want you to put your mouse right below 50% and not too far from 50% at the same time) (Also another mistake I did was that the red dot is too below! Make sure your mouse is welll above the name almost to the top while you click eithr c,1,2,3,4,5)The more precise, the better the script works. This is very important you have to be very precise so you should take all the time you want but don't screw this up.
Heck you can even use a ruler! I don't mind.
Go over to the first player's health bar, do the above make sure you are JUST BELOW 50%. and press '1' in your keyboard. If you think you have screwed up, click 1 again to update the value.
Vice versa click '2' for the second bar, '3' for third, '4' for fourth and finally '5' for fifth.
Now when you are confident that you got everything right, click r.
(Remember that you can click c,1,2,3,4,5 as many times as you like, it will keep re-updating the value so you can try to be as precise as possible)
And take a picture of the msgbox and attach it in this thread so I can see it.
Another thing to keep in mind is, make sure that your game window is in the size or manner you want it to be, when using the script. Also make sure that your game is the active window, this is important.
IMPORTANT NOTE: MAKE SURE YOU ARE WELL ABOVE THE NAMES WHILE PRESSING C,1,2,3,4,5.
You have to run this script when you're playing the game.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2
Coordmode, mouse, client
Coordmode, pixel, client
c::
Mousegetpos, X, Y
PixelGetcolor, Color, %X%, %Y%
return
1:: Mousegetpos, X1, Y1
2:: MouseGetPos, X2, Y2
3:: MouseGetPos, X3, Y3
4:: MouseGetPos, X4, Y4
5:: MouseGetPos, X5, Y5
r::
Msgbox, Color = %Color%. First = %X1%. %Y1%. Second = %X2%. %Y2%. Third = %X3%. %Y3%. Fourth = %X4%. %Y4%. Fifth = %X5%. %Y5%.
return
esc:: ExitApp ; esc, exits the script
So here is what I want you to do:
Enter the game so you have the healthbars displaying, now press Ctrl+S to start the script.
Move your mouse on top of the healthbar (any of them) and click the button 'c'. This is for the color.
And now is the tricky part. I want you to move your mouse over on the healthbar making sure that you are approximately half way of the healthbar and just a few pixels left. (As you can see I'm not below 50% in the attachment but you get the point, I want you to put your mouse right below 50% and not too far from 50% at the same time) (Also another mistake I did was that the red dot is too below! Make sure your mouse is welll above the name almost to the top while you click eithr c,1,2,3,4,5)The more precise, the better the script works. This is very important you have to be very precise so you should take all the time you want but don't screw this up.
Heck you can even use a ruler! I don't mind.
Go over to the first player's health bar, do the above make sure you are JUST BELOW 50%. and press '1' in your keyboard. If you think you have screwed up, click 1 again to update the value.
Vice versa click '2' for the second bar, '3' for third, '4' for fourth and finally '5' for fifth.
Now when you are confident that you got everything right, click r.
(Remember that you can click c,1,2,3,4,5 as many times as you like, it will keep re-updating the value so you can try to be as precise as possible)
And take a picture of the msgbox and attach it in this thread so I can see it.
Another thing to keep in mind is, make sure that your game window is in the size or manner you want it to be, when using the script. Also make sure that your game is the active window, this is important.
IMPORTANT NOTE: MAKE SURE YOU ARE WELL ABOVE THE NAMES WHILE PRESSING C,1,2,3,4,5.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
Wow, thanks for the easy read tutorial setting this up initially. To be honest, I never did except anyone to actually be this helpful, I'm very grateful!
So I tried my best setting this up, I'm not completely sure its directly below 50% HP - my "mouse" hand has an injury so I'm shaking abit rapidly, I'm strictly using a Xbox controller nowadays to ease the little pain I get and it tends to be easier to use for an hour or two I get each time to play. I got two kids so at night when I can play I actually get more time than 1-2hours but I'm so damn beat after working and running and playing with the kids when I'm home its all I can manage, hehe!
Anyway, I tried using an overlay (arrows) and put those close around the 50% HP mark and used your script and used the arrows to get as close to 50% I could, I used my Xbox controller as a mouse, I cant really use a normal one, hehe.
I attached the image your requested as an attachment. Thank you very much for helping, yet again.
I'm truely grateful!
Best regards!
So I tried my best setting this up, I'm not completely sure its directly below 50% HP - my "mouse" hand has an injury so I'm shaking abit rapidly, I'm strictly using a Xbox controller nowadays to ease the little pain I get and it tends to be easier to use for an hour or two I get each time to play. I got two kids so at night when I can play I actually get more time than 1-2hours but I'm so damn beat after working and running and playing with the kids when I'm home its all I can manage, hehe!
Anyway, I tried using an overlay (arrows) and put those close around the 50% HP mark and used your script and used the arrows to get as close to 50% I could, I used my Xbox controller as a mouse, I cant really use a normal one, hehe.
I attached the image your requested as an attachment. Thank you very much for helping, yet again.
I'm truely grateful!
Best regards!
Re: Healing script
Good job! The logic was that the script will search that pixel's color, so when the player loses health, the pixel changes color and triggers the script.
But I just realized that the health has a small variation in color. But PixelGetColor does support shades of color variation so we will try to work with that, I don't want to make you do it all again haha.
Now pretty much you have what you need for that script.
Tell me exactly what you want in the script. Hotkeys and etc. Since you are not sending input to the game through ahk, there is no question about the game blocking it. Anyways, If not me anybody else can also help you with this script, or they might fix or suggest a better method to do stuff.
I say that because I'm not sure when I will be and won't be able to go online.
But I just realized that the health has a small variation in color. But PixelGetColor does support shades of color variation so we will try to work with that, I don't want to make you do it all again haha.
Now pretty much you have what you need for that script.
Tell me exactly what you want in the script. Hotkeys and etc. Since you are not sending input to the game through ahk, there is no question about the game blocking it. Anyways, If not me anybody else can also help you with this script, or they might fix or suggest a better method to do stuff.
I say that because I'm not sure when I will be and won't be able to go online.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
How did you detect the small variation in the color? Trying to learn at the same time!
Well, eventually I would like to have 4 "trigger" points per health bar as I'm pretty certain just having a 50% trigger won't cut it in some occassions,however I'm not even sure where to begin on adding more trigger points (perhaps you could add some blank cordinates into the script and write in text "add 10.25,75% cords here"?
it's also important that it only does on action per hotkey press.
As far as hotkey goes, I'm pretty sure this has to be done with trial and error as I haven't really set things up ingame for this sort of thing yet, I'll just write down examples and I'll figure stuff out myself by reading and changing them later when I have some more knowledge!
When I press the E key I want it to scan if any healthbars is below 50% and if no health is below 50% I want it to do nothing.
If any healthbar is below 50% I want it to send F1 = bar1, F2 = bar2, F3 = bar3 F4 = bar4 F5 = bar5
Once F1-5 have been sent, I want to be able to press E key again to perform an action, Number 1-5 corresponding the bar1-5. Does that make sense?
And the Next time I press E, it scans again.
I'll be spamming the E key every 0.5 seconds or so but I don't want it automated, needs to follow a 1 E key press per key event.
Does this make any sense to you?
You're the only one replied so far so I guess you're my hope now. Haha
Thanks for helping out,
Best regards.
Well, eventually I would like to have 4 "trigger" points per health bar as I'm pretty certain just having a 50% trigger won't cut it in some occassions,however I'm not even sure where to begin on adding more trigger points (perhaps you could add some blank cordinates into the script and write in text "add 10.25,75% cords here"?
it's also important that it only does on action per hotkey press.
As far as hotkey goes, I'm pretty sure this has to be done with trial and error as I haven't really set things up ingame for this sort of thing yet, I'll just write down examples and I'll figure stuff out myself by reading and changing them later when I have some more knowledge!
When I press the E key I want it to scan if any healthbars is below 50% and if no health is below 50% I want it to do nothing.
If any healthbar is below 50% I want it to send F1 = bar1, F2 = bar2, F3 = bar3 F4 = bar4 F5 = bar5
Once F1-5 have been sent, I want to be able to press E key again to perform an action, Number 1-5 corresponding the bar1-5. Does that make sense?
And the Next time I press E, it scans again.
I'll be spamming the E key every 0.5 seconds or so but I don't want it automated, needs to follow a 1 E key press per key event.
Does this make any sense to you?
You're the only one replied so far so I guess you're my hope now. Haha
Thanks for helping out,
Best regards.
Re: Healing script
Actually I just got a better idea just now.
Run any ahk script. Search the script in your system tray, right click it and click on window spy. It shoudl display you a number of information, We want the information under "Mouse Position". The one under "Mouse Position" we want, is "Client" Right next to client, to the right side, there will be number,number.
Those are the coordinates we need.
So launch your game. Pick any character's healthbar, suppose Krenn. Now give me the left most and right most coordinates of the healthbar of, krenn for example.
Only one of the healthbar. And make sure that your mouse is in the pink region of the healthbar.
The logic is we can probably estimate %ages via distance of coordinates. With this we can even estimate 10%,20% etc!
Run any ahk script. Search the script in your system tray, right click it and click on window spy. It shoudl display you a number of information, We want the information under "Mouse Position". The one under "Mouse Position" we want, is "Client" Right next to client, to the right side, there will be number,number.
Those are the coordinates we need.
So launch your game. Pick any character's healthbar, suppose Krenn. Now give me the left most and right most coordinates of the healthbar of, krenn for example.
Only one of the healthbar. And make sure that your mouse is in the pink region of the healthbar.
The logic is we can probably estimate %ages via distance of coordinates. With this we can even estimate 10%,20% etc!
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
1) It's in one of PixelGetColor's parametergsboxing wrote:How did you detect the small variation in the color? Trying to learn at the same time!
Well, eventually I would like to have 4 "trigger" points per health bar as I'm pretty certain just having a 50% trigger won't cut it in some occassions,however I'm not even sure where to begin on adding more trigger points (perhaps you could add some blank cordinates into the script and write in text "add 10.25,75% cords here"?
it's also important that it only does on action per hotkey press.
As far as hotkey goes, I'm pretty sure this has to be done with trial and error as I haven't really set things up ingame for this sort of thing yet, I'll just write down examples and I'll figure stuff out myself by reading and changing them later when I have some more knowledge!
When I press the E key I want it to scan if any healthbars is below 50% and if no health is below 50% I want it to do nothing.
If any healthbar is below 50% I want it to send F1 = bar1, F2 = bar2, F3 = bar3 F4 = bar4 F5 = bar5
Once F1-5 have been sent, I want to be able to press E key again to perform an action, Number 1-5 corresponding the bar1-5. Does that make sense?
And the Next time I press E, it scans again.
I'll be spamming the E key every 0.5 seconds or so but I don't want it automated, needs to follow a 1 E key press per key event.
Does this make any sense to you?
You're the only one replied so far so I guess you're my hope now. Haha
Thanks for helping out,
Best regards
2) Yea yea we will do that too.
3) answered to by last reply
4) Okay we will bind the pixelsearches to your hotkey.
Now I have to clarify about the script.
Here is what you want to happen, correct me if I'm wrong:-
1) Pressing E once, checks if all bars are above 50% or not.
2) If all bars are above 50%, don't do anything
3) If one of the bars do not have 50% health, retrieve which bar it is and accordingly send either F1, F2, F3, F4 or f5.
F1 for the first bar if is below 50% and etc.
4) Now clicking E will send either 1, 2, 3, 4 or 5 depending on which bar had below 50% health.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
1) Pressing E once, checks if all bars are above 50% or not. ;; Exactly, unless we add more "trigger points" which I would like in the end, otherwise I guess it will have to check all 4 different ones?
2) If all bars are above 50%, don't do anything Exactly, unless stated above
3) If one of the bars do not have 50% health, retrieve which bar it is and accordingly send either F1, F2, F3, F4 or f5.
F1 for the first bar if is below 50% and etc. If no health bar below triggers points do nothing, if a healthbar is below a trigger point, retrieve which bar and send either F1-F5,
correct.
4) Now clicking E will send either 1, 2, 3, 4 or 5 depending on which bar had below 50% health. Yes!
Ok, I got the coordinates using Window Spy!
(While still being in the pink area)
Most Left: 1177, 542 | Color C26F93 (Red=C2 Green=6F Blue=93) <- Don't know if this information is relevant
Most Right: 1311, 542 | Color A86080 Red=A8 Green=60 Blue=80) <- Don't know if this information is relevant
I added in the color because you spoke of shades and to be honest I'm completely lost as to what that is.
Thanks for helping!
Best regards,
Edit: If we do add in 4 trigger points, Say 10% 25% 50% 75% Use (Shown below)
10% = alt + 1-5 (depending on bar)
25% = ctrl + 1-5 (depending on bar)
50% = 1-5 (depending on bar)
75% = shift + 1-5 (depending on bar)
Hopefully this doesn't complicate stuff to much!
2) If all bars are above 50%, don't do anything Exactly, unless stated above
3) If one of the bars do not have 50% health, retrieve which bar it is and accordingly send either F1, F2, F3, F4 or f5.
F1 for the first bar if is below 50% and etc. If no health bar below triggers points do nothing, if a healthbar is below a trigger point, retrieve which bar and send either F1-F5,
correct.
4) Now clicking E will send either 1, 2, 3, 4 or 5 depending on which bar had below 50% health. Yes!
Ok, I got the coordinates using Window Spy!
(While still being in the pink area)
Most Left: 1177, 542 | Color C26F93 (Red=C2 Green=6F Blue=93) <- Don't know if this information is relevant
Most Right: 1311, 542 | Color A86080 Red=A8 Green=60 Blue=80) <- Don't know if this information is relevant
I added in the color because you spoke of shades and to be honest I'm completely lost as to what that is.
Thanks for helping!
Best regards,
Edit: If we do add in 4 trigger points, Say 10% 25% 50% 75% Use (Shown below)
10% = alt + 1-5 (depending on bar)
25% = ctrl + 1-5 (depending on bar)
50% = 1-5 (depending on bar)
75% = shift + 1-5 (depending on bar)
Hopefully this doesn't complicate stuff to much!
Re: Healing script
Hmm okay. I need the coordinates for all the five bars sorry if I was not specific.
You don't have to worry about the color.
my reference ignore this:-
( 1244 , 542 ) <- of Most Left: 1177, 542 Most Right: 1311, 542
so 50%'s pixel = 1243, 542.
You don't have to worry about the color.
my reference ignore this:-
( 1244 , 542 ) <- of Most Left: 1177, 542 Most Right: 1311, 542
so 50%'s pixel = 1243, 542.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
Krenn:
Most Left: 1177, 543
Most Right: 1311, 543
Kostus:
Left: 1034, 543
Right: 1169, 543
Ilia:
Left: 892, 543
Right: 1026, 543
Dreyel:
Left: 748, 543
Right:883, 543
Danicus:
Left: 606, 543
Right: 740,543
These are as close to Most left and Most Right I could snatch, these should be all the coordinates you needed, correct?
Thanks!
Most Left: 1177, 543
Most Right: 1311, 543
Kostus:
Left: 1034, 543
Right: 1169, 543
Ilia:
Left: 892, 543
Right: 1026, 543
Dreyel:
Left: 748, 543
Right:883, 543
Danicus:
Left: 606, 543
Right: 740,543
These are as close to Most left and Most Right I could snatch, these should be all the coordinates you needed, correct?
Thanks!
Re: Healing script
For my reference and people who want to write the script:
Pixels to check for each of the health bars:
(I subtracted the midpoint values of the x coordinates by 2 in case of human error.) Distance b/w is around 135pixels. So at most it might trigger 2-3% hitpoints late.
Krenn = 1242,542
Kostus = 1099, 542
Ilia = 957, 542
Dreyel = 813, 542
Danicus = 671, 542
Pixels to check for each of the health bars:
(I subtracted the midpoint values of the x coordinates by 2 in case of human error.) Distance b/w is around 135pixels. So at most it might trigger 2-3% hitpoints late.
Krenn = 1242,542
Kostus = 1099, 542
Ilia = 957, 542
Dreyel = 813, 542
Danicus = 671, 542
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
I'm just guessing here that 1242/10 = 125~ is the 10% mark? So for 10% it would be 125, 542 ?
How would I go about having 4 trigger points per character?
Thanks alot for investing time into my matter, it's very kind of you!
I'm trying to read between my son naps but it get's kinda confusing, when I look for example codes related to what I want to do, the codes are quite different and I can't tell them apart. Seems to be different languages for the same thing.
I'll keep reading the ahk wiki while waiting for help
Best regards,
How would I go about having 4 trigger points per character?
Thanks alot for investing time into my matter, it's very kind of you!
I'm trying to read between my son naps but it get's kinda confusing, when I look for example codes related to what I want to do, the codes are quite different and I can't tell them apart. Seems to be different languages for the same thing.
I'll keep reading the ahk wiki while waiting for help
Best regards,
Re: Healing script
No No No 1244 is the midpoint between 1177, 543 and 1311, 543 it is not the pixel distance. They are two different things. Remember Coordinate geometry from school? That's what I'm using here.gsboxing wrote:I'm just guessing here that 1242/10 = 125~ is the 10% mark? So for 10% it would be 125, 542 ?
How would I go about having 4 trigger points per character?
Thanks alot for investing time into my matter, it's very kind of you!
I'm trying to read between my son naps but it get's kinda confusing, when I look for example codes related to what I want to do, the codes are quite different and I can't tell them apart. Seems to be different languages for the same thing.
I'll keep reading the ahk wiki while waiting for help
Best regards,
Since 1244 is the midpoint, it would be 50% for the healthbar. Understand? I subtracted 2 from 1244 just for good measure.
How would I go about having 4trigger points per character?
Divide the health bar into 4parts. First find the midpoint coordinate of the left most and right most coordinate using the formula, and
then to get 25% find the midpoint of left most and middle, and for 75% the right most and the middle.
Hope it makes sense?
If you want you can also use pixel distance. For that just subtract the right most x coordinate from the left most x coordinate and find the times %age you want and add that to the left most x coordinate and you will get the required new x coordinate. If you want something like 20% then we will have to use pixel distance.
It shouldn't make a difference for 25%,50%,75% though.
Yea and I agree that scripts are very different. The way a person approach a task is very different from another person. That doesn't hinder the output though, most of the time, it's just about convenience and only sometimes about reliability or performance. Everybody is at different learning stages. I'm at the beginning so my code will be just ifs and elses whereas a pro's would be complicated yet simplistic!
Good luck with your family.
Btw I would spend some time reading some of the guide https://autohotkey.com/docs/Tutorial.htm. Rather than searching online and trying to make sense of stuff. You need to be able to understand what people have posted online before trying to make sense of it.
I am your average ahk newbie. Just.. a tat more cute.
Re: Healing script
Ha, yes that makes more sense. Guess im abit dumb
If else / elseif I find more readable even if arrays looks better.
Thanks for the link Ill make sure to read it while waiting for helping hand, haha! Its gonna be a reading Night, fun! Sarcasm
If else / elseif I find more readable even if arrays looks better.
Thanks for the link Ill make sure to read it while waiting for helping hand, haha! Its gonna be a reading Night, fun! Sarcasm
Who is online
Users browsing this forum: No registered users and 44 guests