Tokra Posted November 12, 2009 Share Posted November 12, 2009 Basicly what i want is for a game is if the Health reaches an amount (Will do with pixel detection on the health bar) that it drinks a potion. This is what im trying to code Pixel at cordinate Turns into color (indicating Health drop under 50%) Then button lets say F10 gets pressed. Also since theres 3 Bars ( Health Stamina and Mana ) Would there be possible for me to make one macro for All 3 rows or would i be having to make 3 diferent macros and run them at same time? (If that is possible) AS a guy with almost 0 skill when it comes to making macros where should i look to learn how to put together these commands. Link to comment Share on other sites More sharing options...
mikjay Posted November 12, 2009 Share Posted November 12, 2009 (edited) What I would recommend first is to use Window Info to get the pixel colors you are looking for, and the window handle. In the simplest form, you could use a Select..Case loop, and in each case tell the script to press the key(s) based on the color. Use a hotkey to exit the script. Winactivate(<your window>) While 1 ;Infinite Loop Select Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The first bar Send("{F10}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The second bar Send("{F11}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The third bar Send("{F12}") EndSelect Wend ;If none are matched, returns to top of loop Hope that helps! Edited November 12, 2009 by mikjay Link to comment Share on other sites More sharing options...
Tokra Posted November 12, 2009 Author Share Posted November 12, 2009 What I would recommend first is to use Window Info to get the pixel colors you are looking for, and the window handle. In the simplest form, you could use a Select..Case loop, and in each case tell the script to press the key(s) based on the color. Use a hotkey to exit the script. Winactivate(<your window>) While 1 ;Infinite Loop Select Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The first bar Send("{F10}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The second bar Send("{F11}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The third bar Send("{F12}") EndSelect Wend ;If none are matched, returns to top of loop Hope that helps! That was prety nice. But when i compile it and try and run it i get an error Line -1: Error: "Wend" statment with no matching "while" statement. Link to comment Share on other sites More sharing options...
Tokra Posted November 12, 2009 Author Share Posted November 12, 2009 Bump Link to comment Share on other sites More sharing options...
mikjay Posted November 12, 2009 Share Posted November 12, 2009 Tokra, I have no problems running it. Can you show me the exact code you used? Link to comment Share on other sites More sharing options...
Tokra Posted November 12, 2009 Author Share Posted November 12, 2009 Tokra, I have no problems running it. Can you show me the exact code you used? WinWaitActive("Darkfall Online") While 1 ;Infinite Loop Select Case Hex(PixelGetColor(<64,570>)) = "<BF2525>" ;The first bar Send("{F5}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The second bar Send("{F11}") Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The third bar Send("{F12}") Wend ;If none are matched, returns to top of loop Link to comment Share on other sites More sharing options...
mikjay Posted November 13, 2009 Share Posted November 13, 2009 Tokra, the line before the Wend should contain an Endselect. Also, since you are trying to get a single bar to work before you move on, comment out the second 2 cases. Another problem is you took my pointed brackets literally. Just enter the coordinates and color hex codes without the brackets. I don't mind showing you the code, but I would appreciate it if you did your homework. That means looking at the helpfile (F1) to get proper syntax. If you can understand the code you are writing, it makes troubleshooting it 150% easier. WinActivate("Darkfall Online") WinWaitActive("Darkfall Online") While 1 ;Infinite Loop Select Case Hex(PixelGetColor(64,570)) = "BF2525" ;The first bar Send("{F5}") ;Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The second bar ;Send("{F11}") ;Case Hex(PixelGetColor(<x,y>)) = "<your hex color>" ;The third bar ;Send("{F12}") EndSelect Wend ;If none are matched, returns to top of loop Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now