The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.
If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.
Difference between revisions of "User:Cegaiel/Macros/GetMousePosition"
Line 28: | Line 28: | ||
</pre> | </pre> | ||
− | Or to search for color: 0xE1D4AC from x,y to x,y (No, they do not need to be the same coordinates, The first x,y is upper left corner, the 2nd x,y is bottom right corner, of an area/rectangle). But since I used the same x,y on both sides, it will only look at one coordinate for the color. Normally you'd use something like 540,341 as upper left corner to search and 600,400 as the lower right corner to search. | + | Or to search for color: 0xE1D4AC from x,y to x,y (No, they do not need to be the same coordinates, The first x,y is upper left corner, the 2nd x,y is bottom right corner, of an area/rectangle). But since I used the same x,y on both sides, it will only look at one coordinate for the color. Normally you'd use something like 540,341 as upper left corner to search and 600,400 as the lower right corner to search. The #25 means to look for the color within 25 shades. So in this case, it doesn't need to find the color exactly, just fairly close. |
<pre> | <pre> |
Revision as of 14:46, 23 February 2010
Get Mouse Position and Color (Autohotkey)
Just launch the script and it will show you this tooltip wherever you move the mouse. All the information on tooltip updates in realtime as you move the mouse.
I wrote this in case I need to find the mouse position that I need to click on or if I need to find the color of where my mouse is hovering.
I mainly added the color gathering portion in case I want to write a macro with the PixelSearch in autohotkey.
Example code for finding color:
This will search for the color 0xE1D4AC (same as html code #E1D4AC) at mouse position 540,341.
PixelGetColor, color, 540, 341, RGB if color = 0xE1D4AC { MsgBox, Color detected }else{ Msgbox, Color not found
Or to search for color: 0xE1D4AC from x,y to x,y (No, they do not need to be the same coordinates, The first x,y is upper left corner, the 2nd x,y is bottom right corner, of an area/rectangle). But since I used the same x,y on both sides, it will only look at one coordinate for the color. Normally you'd use something like 540,341 as upper left corner to search and 600,400 as the lower right corner to search. The #25 means to look for the color within 25 shades. So in this case, it doesn't need to find the color exactly, just fairly close.
PixelSearch, Px, Py, 540, 341, 540, 341, 0xE1D4AC, 25, Fast|RGB if ErrorLevel = 0 { MsgBox, Color detected }else{ Msgbox, Color not found }
To see a simple, small macro of this function in action, look at my Pop up box clicker macro. It looks for the yellowish color that occurs in a popup box (ie too tired) and clicks the OK button anytime it occurs.