> From the BotGhost docs: https://botghost.com/docs/custom-commands-and-events/actions/other-actions/trigger-a-custom-event
> Every page: https://botghost.com/docs/llms.txt

# Trigger a Custom Event

Trigger a Custom Event runs one of your events that starts with **When triggered by a block**, and can use what it gives back. Build a flow once as an event, then run it from any command, button or other event. BotGhost's own modules work this way: their commands, buttons and pages run shared events with this block.

## Which event

Pick one of your bot's **When triggered by a block** events. Each one in the list says how many inputs and outputs it has, and whether it comes from a module or is switched off. An event can't trigger itself.

If you import a command whose event isn't on your bot but one with the same name is, the block offers **Use** with that event's name.

## Inputs

Each input the event has gets a box. Fill it in with text or variables, and the event reads it as `{input_NAME}`, like `{input_member}`.

## When it runs

- **Wait for it to finish**: on to start with. The block waits for the event, then goes down the green **Done** path or the red **Failed** path, with what the event gives back. Off, the event runs alongside and the **Done** path carries on straight away, with nothing coming back.
- **Skip it while it's off**: off to start with. While it's off, a switched off or deleted event sends the block down **Failed** and shows in Error Logs. Turn it on and the block does nothing when the event is switched off or deleted: the blocks after it carry on down **Done**, and nothing goes to Error Logs. The event runs again once it's back.

Turn on **Skip it while it's off** when the event belongs to a module that might be off. The [Invite Tracker](https://botghost.com/docs/server-management/invite-tracker) uses it to give Leveling's XP for each member someone invites, so nothing goes wrong while Leveling is off.

Events can start other events up to 5 deep, and an event can never start itself while it runs.

## Variables

| Variable | What it gives |
| --- | --- |
| `{output_NAME}` | What the event set `{NAME}` to, for each of its outputs. Only while **Wait for it to finish** is on |
| `{trigger_problem}` | Why it failed, couldn't start or was skipped. Empty when it ran |
