# Mouse Clicked
Grammar — Player player clicks button|Button mouse button down|up/down.
Flags —Native
|Event
Only register for this event when you absolutely need it, as it will generate network traffic from all players for every mouse click they make. This event fires when a player clicks a mouse button. Use “Mouse Clicked Button” to get the button that was clicked. Use “Mouse Clicked UI Pos X” and “Mouse Clicked UI Pos Y” to get the UI X,Y position where the player clicked the mouse. Use “Mouse Clicked World Pos X”, “Mouse Clicked World Pos Y”, and “Mouse Clicked World Pos Z” to get the X,Y,Z world position where the player clicked the mouse. Use “Alt Key Pressed”, “Control Key Pressed”, and “Shift Key Pressed” to find out what modifier keys were pressed.
# Arguments
int
— Playerint
<preset::MouseButton> — Mouse Buttonbool
<preset::UpDownOption> — Down
Returns — void
native void TriggerAddEventMouseClicked(
trigger t,
int player,
int mouseButton,
bool down,
);
# Event parameters
- Triggering Game User — EventGameUser
- Triggering Player — EventPlayer
- Control Key Pressed — EventKeyControl
- Alt Key Pressed — EventKeyAlt
- Shift Key Pressed — EventKeyShift
- Mouse Clicked Button — EventMouseClickedButton
- Mouse Clicked UI Pos X — EventMouseClickedPosXUI
- Mouse Clicked UI Pos Y — EventMouseClickedPosYUI
- Mouse Clicked World Pos X — EventMouseClickedPosXWorld
- Mouse Clicked World Pos Y — EventMouseClickedPosYWorld
- Mouse Clicked World Pos Z — EventMouseClickedPosZWorld
# Related
Category: UI / Input
- Key Pressed —
void
— TriggerAddEventKeyPressed - Hotkey Pressed —
void
— TriggerAddEventHotkeyPressed - Button Pressed —
void
— TriggerAddEventButtonPressed - Mouse Clicked —
void
— TriggerAddEventMouseClicked - Mouse Moved —
void
— TriggerAddEventMouseMoved - Mouse Wheel —
void
— TriggerAddEventMouseWheel - Button Pressed —
string
<gamelink::Button> — EventButtonPressed - Key Pressed —
int
<preset::Key> — EventKeyPressed - Hotkey Pressed —
int
<preset::Key> — EventHotkeyPressed - Control Key Pressed —
bool
— EventKeyControl - Alt Key Pressed —
bool
— EventKeyAlt - Shift Key Pressed —
bool
— EventKeyShift - Mouse Clicked Button —
int
<preset::MouseButton> — EventMouseClickedButton - Mouse Clicked UI Pos X —
int
— EventMouseClickedPosXUI - Mouse Clicked UI Pos Y —
int
— EventMouseClickedPosYUI - Mouse Clicked World Pos X —
fixed
— EventMouseClickedPosXWorld - Mouse Clicked World Pos Y —
fixed
— EventMouseClickedPosYWorld - Mouse Clicked World Pos Z —
fixed
— EventMouseClickedPosZWorld - Mouse Moved UI Pos X —
int
— EventMouseMovedPosXUI - Mouse Moved UI Pos Y —
int
— EventMouseMovedPosYUI - Mouse Moved World Pos X —
fixed
— EventMouseMovedPosXWorld - Mouse Moved World Pos Y —
fixed
— EventMouseMovedPosYWorld - Mouse Moved World Pos Z —
fixed
— EventMouseMovedPosZWorld - Mouse Wheel Spin —
fixed
— EventMouseWheelSpin
# Examples
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:15031
gt_PinboardItemBack = TriggerCreate("gt_PinboardItemBack_Func");
TriggerEnable(gt_PinboardItemBack, false);
TriggerAddEventMouseClicked(gt_PinboardItemBack, c_playerAny, c_mouseButtonNone, true);
TriggerAddEventKeyPressed(gt_PinboardItemBack, c_playerAny, c_keyNone, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
}
campaigns/liberty.sc2campaign — base.sc2maps/maps/campaign/tstory01.sc2map/MapScript.galaxy:37418
gt_TVNewsBack = TriggerCreate("gt_TVNewsBack_Func");
TriggerEnable(gt_TVNewsBack, false);
TriggerAddEventMouseClicked(gt_TVNewsBack, c_playerAny, c_mouseButtonNone, true);
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:15031
gt_PinboardItemBack = TriggerCreate("gt_PinboardItemBack_Func");
TriggerEnable(gt_PinboardItemBack, false);
TriggerAddEventMouseClicked(gt_PinboardItemBack, c_playerAny, c_mouseButtonNone, true);
TriggerAddEventKeyPressed(gt_PinboardItemBack, c_playerAny, c_keyNone, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
}
campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/tstory01.sc2map — MapScript.galaxy:37418
gt_TVNewsBack = TriggerCreate("gt_TVNewsBack_Func");
TriggerEnable(gt_TVNewsBack, false);
TriggerAddEventMouseClicked(gt_TVNewsBack, c_playerAny, c_mouseButtonNone, true);
}
campaigns/swarm.sc2campaign — base.sc2maps/maps/campaign/swarm/zlab01.sc2map/MapScript.galaxy:9960
gt_CampaignIntroCinematicContinue = TriggerCreate("gt_CampaignIntroCinematicContinue_Func");
TriggerEnable(gt_CampaignIntroCinematicContinue, false);
TriggerAddEventMouseClicked(gt_CampaignIntroCinematicContinue, c_playerAny, c_mouseButtonNone, true);
}
campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zlab01.sc2map — MapScript.galaxy:9960
gt_CampaignIntroCinematicContinue = TriggerCreate("gt_CampaignIntroCinematicContinue_Func");
TriggerEnable(gt_CampaignIntroCinematicContinue, false);
TriggerAddEventMouseClicked(gt_CampaignIntroCinematicContinue, c_playerAny, c_mouseButtonNone, true);
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:6564
libVCUI_gt_PU_ArmyRotateUnitStart = TriggerCreate("libVCUI_gt_PU_ArmyRotateUnitStart_Func");
TriggerEnable(libVCUI_gt_PU_ArmyRotateUnitStart, false);
TriggerAddEventMouseClicked(libVCUI_gt_PU_ArmyRotateUnitStart, c_playerAny, c_mouseButtonLeft, true);
}
campaigns/voidstory.sc2campaign — base.sc2data/TriggerLibs/VoidCampaignUILib.galaxy:6618
libVCUI_gt_PU_ArmyRotateUnitEnd = TriggerCreate("libVCUI_gt_PU_ArmyRotateUnitEnd_Func");
TriggerEnable(libVCUI_gt_PU_ArmyRotateUnitEnd, false);
TriggerAddEventMouseClicked(libVCUI_gt_PU_ArmyRotateUnitEnd, c_playerAny, c_mouseButtonNone, false);
}
mods/frontiers.sc2mod — base.sc2data/Lib6CB3363F.galaxy:1564
void lib6CB3363F_gt_MouseRightClickPressedMelee_Init () {
lib6CB3363F_gt_MouseRightClickPressedMelee = TriggerCreate("lib6CB3363F_gt_MouseRightClickPressedMelee_Func");
TriggerAddEventMouseClicked(lib6CB3363F_gt_MouseRightClickPressedMelee, c_playerAny, c_mouseButtonRight, true);
}
mods/frontiers.sc2mod — base.sc2data/Lib6CB3363F.galaxy:1606
void lib6CB3363F_gt_MouseLeftClickPressedFireWeapon_Init () {
lib6CB3363F_gt_MouseLeftClickPressedFireWeapon = TriggerCreate("lib6CB3363F_gt_MouseLeftClickPressedFireWeapon_Func");
TriggerAddEventMouseClicked(lib6CB3363F_gt_MouseLeftClickPressedFireWeapon, c_playerAny, c_mouseButtonLeft, true);
}
mods/frontiers.sc2mod — base.sc2data/Lib6CB3363F.galaxy:1646
void lib6CB3363F_gt_MouseLeftClickReleased_Init () {
lib6CB3363F_gt_MouseLeftClickReleased = TriggerCreate("lib6CB3363F_gt_MouseLeftClickReleased_Func");
TriggerAddEventMouseClicked(lib6CB3363F_gt_MouseLeftClickReleased, c_playerAny, c_mouseButtonLeft, false);
}
mods/heroesdata.stormmod — base.stormdata/TriggerLibs/GameDataHelperLib.galaxy:22994
}
TriggerAddEventMouseClicked(libGDHL_gt_HeroTinkerDethLazorLeftClick, lv_player, c_mouseButtonLeft, true);
return true;
}
mods/heromods/alarak.stormmod — base.stormdata/LibHALA.galaxy:166
}
TriggerAddEventMouseClicked(libHALA_gt_HeroAlarakDeadlyChargeCasterClicked, lv_player, c_mouseButtonLeft, true);
return true;
}
mods/heromods/chogall.stormmod — base.stormdata/LibHCHO.galaxy:1526
lv_playerID = libGame_gf_HeroSpawnPlayer();
TriggerAddEventMouseClicked(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventPlayerEffectUsed(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_playerID,"ChoSurgingFistTriggerDummyEffect");
if (((UnitGetType(libGame_gv_players[lv_playerID].lv_activeVehicle) == "HeroCho") || (UnitGetType(libGame_gv_players[lv_playerID].lv_heroUnit) == "HeroCho"))) {
mods/heromods/chogall.stormmod — base.stormdata/LibHCHO.galaxy:1783
UISetCommandAllowed(PlayerGroupSingle(lv_gallPlayer), c_uiCommandAllowQueue, false);
TriggerAddEventMouseMoved(libHCHO_gt_SurgingFistMouseTracker, lv_gallPlayer);
TriggerAddEventMouseClicked(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_gallPlayer, c_mouseButtonLeft,true);
TriggerAddEventPlayerEffectUsed(libHCHO_gt_SurgingFistExecuteChargetomouse, lv_gallPlayer,"ChoSurgingFistTriggerDummyEffect");
libGame_gv_players[lv_gallPlayer].lv_suppressHeroAnnouncements = true;
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:118
}
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:119
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
return true;
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:120
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
return true;
}
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:154
}
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:155
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
return true;
mods/heromods/yrel.stormmod — base.stormdata/LibHYRL.galaxy:156
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelVindicationPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelRighteousHammerPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
TriggerAddEventMouseClicked(libHYRL_gt_HeroYrelAvengingWrathPlayerClicked, lv_playerID, c_mouseButtonLeft,true);
return true;
}
mods/novastoryassets.sc2mod — base.sc2maps/maps/campaign/nova/nstory01.sc2map/MapScript.galaxy:437
TriggerEnable(gt_StorySoFarAnyButtonPressed, false);
TriggerAddEventKeyPressed(gt_StorySoFarAnyButtonPressed, c_playerAny, c_keyNone, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
TriggerAddEventMouseClicked(gt_StorySoFarAnyButtonPressed, c_playerAny, c_mouseButtonNone, false);
}
mods/novastoryassets.sc2mod/base.sc2maps/maps/campaign/nova/nstory01.sc2map — MapScript.galaxy:437
TriggerEnable(gt_StorySoFarAnyButtonPressed, false);
TriggerAddEventKeyPressed(gt_StorySoFarAnyButtonPressed, c_playerAny, c_keyNone, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore);
TriggerAddEventMouseClicked(gt_StorySoFarAnyButtonPressed, c_playerAny, c_mouseButtonNone, false);
}