Project

General

Profile

$click » History » Version 3

Per Amundsen, 02/16/2023 09:22 PM

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