$mouse
From Scriptwiki
$mouse
Properties: win, x, y, mx, my, dx, dy, key, lb
Returns the x, y position of the current mouse event, and whether the left mouse button, shift key, and/or control key are pressed. The $mouse identifier can be used in the mouse/click events.
For $mouse.key you can use the & bitwise operator to check if the left button, shift key, and/or control key are pressed:
if ($mouse.key & 1) echo left button is pressed. if ($mouse.key & 2) echo control key is pressed. if ($mouse.key & 4) echo shift key is pressed. if ($mouse.key & 8) echo alt key is pressed. if ($mouse.key & 16) echo right mouse button is pressed.
Properties:
.win property returns the name of the active window. .x/.y returns mouse x- and y-coordinates relative to active window .mx/.my returns mouse x- and y-coordinates relative to mirc window .dx/.dy returns mouse x- and y-coordinates relative to desktop .lb property returns $true if a mouse event occurred over a listbox, or $false if it didn't.
The following menu commands are available for mouse actions:
mouse: triggers when mouse moves in a window sclick: triggers on single left-click (mouse1; left button) dclick: triggers on double click (mouse1; left button) uclick: triggers when button is released inside window, triggers before drop (mouse1; left button) rclick: triggers on single right-click (mouse2; right button) lbclick: triggers when user single clicks on window listbox leave: triggers when mouse moves outside from window area $leftwin = windowname, $leftwinwid = windowID drop: triggers when button is released inside the window (mouse1; left button)
Example:
; First we'll need to create a picture window from editbox: ; -p means it's a picture window, first @test is the name of the window, the second @test is the name of the popupfile ; (we'll use the window's name so we can use the menu prefix in remote script) /window -p @test @test ; the menu for our @test window menu @test { ; "mouse" triggers whenever mouse moves in the window, and executes draw alias mouse:draw ; "dclick" triggers whenever user doubleclicks in the window, we'll use this to clear the window dclick:clear @test } ; this is the alias that is executed everytime mouse moves in @test window alias draw { ; an if to check if left mouse button is pressed, if so draw a dot into the window with colorcode 4, size 2px, ; and read the X and Y location for the dot from $mouse.x and $mouse.y if ($mouse.key & 1) { drawdot @test 4 2 $mouse.x $mouse.y } ; else if left mouse button wasn't pressed, see if right mouse button was ; we'll do the drawdot like earlier, but use background color as the color (erase) and make it a bit bigger elseif ($mouse.key & 16) { drawdot @test $color(background) 6 $mouse.x $mouse.y } }