Project

General

Profile

$click » History » Revision 2

Revision 1 (Per Amundsen, 08/14/2014 04:40 AM) → Revision 2/3 (Per Amundsen, 08/10/2015 08:59 AM)

_Added in 1.9.4_ 

 *$click(@window, N)* 

 Retrieves mouse click information from a picture window. 

 If no properties is defined, returns both X Y. 

 *Parameters* 

 @window - Picture window to use. 
 N - The Nth N'th mouse click item, if N = 0, returns number of mouse click items. 

 *Properties* 

 .x - Returns the X coordinate of the mouse click. 
 .y - Returns the Y coordinate of the mouse click. 

 *Example* 

 <pre> 
 ; Create the custom alias to launch the example 
 ; 
 ; Synopsis: /clickWatch 
 
 alias clickWatch {  
   ; Create ;Create a custom picture window, which is centered. 
   window -dpC @clicker 0 0 250 125 
 
   ; Custom ;Custom 'update' alias keeps code from repeating. 
   ; During ;During initial launch the values should be empty. 
   update 15 Total Clicks: empty 
   update 35 Current Position: none yet 
   update 55 Previous Position: none yet 
 } 
 ; Monitor ;Monitor the sclicks in our custom '@clicker' window. 
 menu @clicker    { 
   sclick: { 
 
     ; Clear ;Clear the window for the new value updates. 
     clear @clicker 
 
     ; Set ;Set the %current and %prev variables to the current. 
     ; x/y ;x/y click location, and to the previous x/y click. 
     ; locations, ;locations, respectively. 
     var %current = $click(@clicker,0), %prev = $calc(%current - 1) 
 
     ; Utilizing ;Utilizing the custom 'update' alias, update the data. 
     update 15 Total Clicks: $click(@clicker,0) 
     update 35 Current Position: $click(@clicker,%current) 
     update 55 Previous Position: $iif(%prev,$click(@clicker,%prev),none yet) 
   } 
 } 
 ; Custom ;Custom update alias removes a lot of the /drawtext repetition. 
 ; from ;from this example. 
 alias -l update { 
   drawtext @clicker $color(normal) 7 $1 $2- 
 } 
 </pre>