$click » History » Version 2
Per Amundsen, 08/10/2015 08:59 AM
1 | 1 | Per Amundsen | _Added in 1.9.4_ |
---|---|---|---|
2 | |||
3 | *$click(@window, N)* |
||
4 | |||
5 | Retrieves mouse click information from a picture window. |
||
6 | |||
7 | If no properties is defined, returns both X Y. |
||
8 | |||
9 | *Parameters* |
||
10 | |||
11 | @window - Picture window to use. |
||
12 | 2 | Per Amundsen | N - The Nth mouse click item, if N = 0, returns number of mouse click items. |
13 | 1 | Per Amundsen | |
14 | *Properties* |
||
15 | |||
16 | .x - Returns the X coordinate of the mouse click. |
||
17 | .y - Returns the Y coordinate of the mouse click. |
||
18 | |||
19 | *Example* |
||
20 | |||
21 | <pre> |
||
22 | ; Create the custom alias to launch the example |
||
23 | ; |
||
24 | ; Synopsis: /clickWatch |
||
25 | |||
26 | alias clickWatch { |
||
27 | 2 | Per Amundsen | ; Create a custom picture window, which is centered. |
28 | 1 | Per Amundsen | window -dpC @clicker 0 0 250 125 |
29 | |||
30 | 2 | Per Amundsen | ; Custom 'update' alias keeps code from repeating. |
31 | ; During initial launch the values should be empty. |
||
32 | 1 | Per Amundsen | update 15 Total Clicks: empty |
33 | update 35 Current Position: none yet |
||
34 | update 55 Previous Position: none yet |
||
35 | } |
||
36 | 2 | Per Amundsen | ; Monitor the sclicks in our custom '@clicker' window. |
37 | 1 | Per Amundsen | menu @clicker { |
38 | sclick: { |
||
39 | |||
40 | 2 | Per Amundsen | ; Clear the window for the new value updates. |
41 | 1 | Per Amundsen | clear @clicker |
42 | |||
43 | 2 | Per Amundsen | ; Set the %current and %prev variables to the current. |
44 | ; x/y click location, and to the previous x/y click. |
||
45 | ; locations, respectively. |
||
46 | 1 | Per Amundsen | var %current = $click(@clicker,0), %prev = $calc(%current - 1) |
47 | |||
48 | 2 | Per Amundsen | ; Utilizing the custom 'update' alias, update the data. |
49 | 1 | Per Amundsen | update 15 Total Clicks: $click(@clicker,0) |
50 | update 35 Current Position: $click(@clicker,%current) |
||
51 | update 55 Previous Position: $iif(%prev,$click(@clicker,%prev),none yet) |
||
52 | } |
||
53 | } |
||
54 | 2 | Per Amundsen | ; Custom update alias removes a lot of the /drawtext repetition. |
55 | ; from this example. |
||
56 | 1 | Per Amundsen | alias -l update { |
57 | drawtext @clicker $color(normal) 7 $1 $2- |
||
58 | } |
||
59 | </pre> |