# Mouse Clicked

Grammar — Player player clicks button|Button mouse button down|up/down.
FlagsNative | 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

Returns — void

native void TriggerAddEventMouseClicked(
	trigger t,
	int player,
	int mouseButton,
	bool down,
);

# Event parameters

Category: UI / Input

# Examples

campaigns/liberty.sc2campaignbase.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.sc2campaignbase.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.sc2mapMapScript.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.sc2mapMapScript.galaxy:37418

    gt_TVNewsBack = TriggerCreate("gt_TVNewsBack_Func");
    TriggerEnable(gt_TVNewsBack, false);
    TriggerAddEventMouseClicked(gt_TVNewsBack, c_playerAny, c_mouseButtonNone, true);
}

campaigns/swarm.sc2campaignbase.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.sc2mapMapScript.galaxy:9960

    gt_CampaignIntroCinematicContinue = TriggerCreate("gt_CampaignIntroCinematicContinue_Func");
    TriggerEnable(gt_CampaignIntroCinematicContinue, false);
    TriggerAddEventMouseClicked(gt_CampaignIntroCinematicContinue, c_playerAny, c_mouseButtonNone, true);
}

campaigns/voidstory.sc2campaignbase.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.sc2campaignbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.stormmodbase.stormdata/TriggerLibs/GameDataHelperLib.galaxy:22994

    }

    TriggerAddEventMouseClicked(libGDHL_gt_HeroTinkerDethLazorLeftClick, lv_player, c_mouseButtonLeft, true);
    return true;
}

mods/heromods/alarak.stormmodbase.stormdata/LibHALA.galaxy:166

    }

    TriggerAddEventMouseClicked(libHALA_gt_HeroAlarakDeadlyChargeCasterClicked, lv_player, c_mouseButtonLeft, true);
    return true;
}

mods/heromods/chogall.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.stormmodbase.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.sc2modbase.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.sc2mapMapScript.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);
}