VirtualMouse

Methods
7
Fields
None

Methods

MethodReturnsDescription
moveMouse(Point)booleanMove the cursor to the canvas point point, through the virtual mouse, and leave it there, pressing nothing (the game shows what is under…
rightClick(Point)booleanMove to the canvas point point and right-click there, through the virtual mouse, which opens the game's menu for what is under it.
middleClick(Point)booleanMove to the canvas point point and middle-click there. false, and nothing pressed, while the game's "Middle mouse button controls the c…
scrollWheel(Point, number)booleanMove to the canvas point point and turn the wheel wheelRotation detents (positive toward the user: over the scene the game zooms out; n…
cameraDrag(number, number)booleanRotate the camera by dragging with the middle button by (deltaX, deltaY) canvas pixels from near the canvas centre. The game turns the…
cameraDragSequence({number}, {number})booleanCamera drags one after another, each as cameraDrag, with a pause between two. false, and nothing queued, when the arrays differ in leng…
dragWidget(number, number, number, number)booleanDrag the widget sourceId (a packed component id; sourceSlot its dynamic child, or -1 for the component itself) onto targetId / `targe…

Method details

moveMouse

moveMouse: (Point) -> boolean

Move the cursor to the canvas point point, through the virtual mouse, and leave it there, pressing nothing (the game shows what is under it).

rightClick

rightClick: (Point) -> boolean

Move to the canvas point point and right-click there, through the virtual mouse, which opens the game's menu for what is under it.

middleClick

middleClick: (Point) -> boolean

Move to the canvas point point and middle-click there. false, and nothing pressed, while the game's "Middle mouse button controls the camera" option is off: the game would take the press as a left click.

scrollWheel

scrollWheel: (Point, number) -> boolean

Move to the canvas point point and turn the wheel wheelRotation detents (positive toward the user: over the scene the game zooms out; negative zooms in). One wheel event per detent, as a turned wheel sends them; at most 20.

cameraDrag

cameraDrag: (number, number) -> boolean

Rotate the camera by dragging with the middle button by (deltaX, deltaY) canvas pixels from near the canvas centre. The game turns the camera from a middle drag only with its "Middle mouse button controls the camera" option on; with it off this answers false and presses nothing.

cameraDragSequence

cameraDragSequence: ({number}, {number}) -> boolean

Camera drags one after another, each as cameraDrag, with a pause between two. false, and nothing queued, when the arrays differ in length or are empty, the canvas is unknown, or the camera option is off. Should a later drag fail to queue for another reason, the earlier ones stay queued and this answers false.

dragWidget

dragWidget: (number, number, number, number) -> boolean

Drag the widget sourceId (a packed component id; sourceSlot its dynamic child, or -1 for the component itself) onto targetId / targetSlot, to rearrange an inventory or bank item. The game performs the move (onDrag, onDragComplete, IF_BUTTOND) with its own checks; the button is held past the widget's drag dead time. false, and nothing pressed, for a source the game would not drag (no drag parent, not on screen) or a drop within its drag dead zone: the release would then click the item.