 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Scratch
Joined: 22 Jan 2009 Posts: 72
|
Posted: Wed Mar 10, 2010 1:11 am Post subject: Hotpics & Hotpix |
|
|
The strength and popularity of AHK, as it name suggests, is in its Hot Eventtriggers in response to keycombinations, mousemovements etc.
Another key feature we all love is imagesearch,
...But you can't execute imagesearches out of order or have it start threads asynchronously unless you are pretty experienced with interrupt timers and then you have to pay much attention to the devil in the details / write code to tie up the loose threads/timers
And thus, most people dealing with lots of dynamic graphics, such as in gamescripts, write serial code with consecutive imagesearches and a whole tree of IF...ELSE branches/flow control to deal with the occurences/exceptions/combinations of searched images.
As the amount of searched images and testing for combined occurences on screen grows, the required branch tree code tends to grow exponentially and more prone to errors, not catching all exceptions or for some reason getting stuck at the wrong branch.
Anyway a lot of code to write and even more to debug, so why not offer some kind of Hotpic support and do away with all this overhead?
For example:
| Code: |
; Thread will trigger if square found anywhere on screen
[[square.bmp]]
msgbox square found
return
; Context sensitive Thread will trigger IF paint windows exists AND square AND circle be found at specified coords
#IfWinExists Paint
[[100,100,square.bmp][200,150,circle.bmp]]
msgbox This looks like a genuine Van Gogh
return
;Thread will not trigger unless square AND circle AND triangle be found anyware on the screen
[[square.bmp][circle.bmp][triangle.bmp]]
Msgbox That was easy wasn't it?
return
|
Beside Hotpics i can imagine Hotpix working in a similar way, allowing to define pretty complex combos of pixels spread all over the screen, but be able to watch/trigger them as a single object with ease.
For example:
| Code: |
; Thread will trigger if black pixel anywhere AND white pixel found at specified coords on screen
<<0x000000><100,100,0xFFFFFF>>
Msbox Just messing around
return
; Using relative coords (from the previous pixel), build a group of pixels to match/trigger if a green crosshair pattern is found on screen
<<0x008000><0,-10,0x008000><0,20,0x008000><-10,-10,0x008000><20,0,0x008000>>
Msbox Take your shot!
return
|
Naturally, like Hotkeys, hotpics and hotpix could be made case sensitive and be switched on/off or have their intervals modified. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Wed Mar 10, 2010 1:52 am Post subject: |
|
|
I completely disagree. There are fine methods to reduce your code if it looks like a monster that's about to eat you. Also, many times, "dealing with timers and the details" is a matter of reading the manual and, most importantly, practicing. Finally, searching for pixels/images endlessly would be the worst possible solution if you need anything else to be done meanwhile. _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|