mouse_lastbutton

This variable returns the last mouse button that was pressed and can return any of the special mouse constants except mb_any (you may also set this variable to one of the constants).

 

Syntax:

mouse_lastbutton

 

Returns:

Mouse Button Constant (except mb_any)

 

Example:

if (mouse_lastbutton == mb_left)
{
    x -= 1;
}

This code moves the current instance left if the last button pressed was the left mouse button.