# Triggers

## Use Cases:

* Projectiles
* Skills/spells (PowerUps + VFX)
* HUD mode selection
* Menu selection (assets or Indicator text as menus)

{% hint style="warning" %}
Set **Broadcast Type** to *All* or *Rules* to send messages from objects to the Rules System.
{% endhint %}

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2Fi9iQyynlY4aKN4cTyZn0%2FGM%20Rules%20KeyMouseInput%20sm%20opt.gif?alt=media&#x26;token=71f769c9-ce89-496d-b1ca-65e85994e1fe" alt=""><figcaption><p>New Key and Mouse Input rules</p></figcaption></figure>

## Key Input

{% tabs %}
{% tab title="About" %}
Send a message when a specific key (0-9) is pressed down or released.

{% hint style="info" %}
Updated in GM 0.11 to bind and unbind a key with messages and include a short description players can see by pressing <kbd>**\`**</kbd>.
{% endhint %}

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2Fa1MkowRPyZ18wFrEQXi8%2Fimage.png?alt=media&#x26;token=7eca4777-5ff8-46b1-895f-1b748ee3bb95" alt="" width="308"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Details" %}

#### Bind Message

Select the message that will bind the rule's outgoing message to the selected key. After it is received, the rule will send the messages every time the key is pressed/released.

#### Select Key

Select the key that is bound using this rule.

#### Description

Enter the description, which will be shown for the key when users press <kbd>\`</kbd> while playing.

#### Message to Send on Key Down

Select the message that will be sent when the key is pressed down.

#### Message to Send on Key Up

Select the message that will be sent when the key is released.

#### Unbind message

Select the message that will unbind the rule's outgoing message from the selected key. After this message is received, the rule will NOT send the messages when the key is pressed/released.
{% endtab %}
{% endtabs %}

## Mouse Input

{% tabs %}
{% tab title="Mouse Input" %}
Send a message on mouse button down and a message on mouse button up with specified inputs (left mouse button, center mouse button, right mouse button):

{% hint style="info" %}
Updated in GM 0.11 to bind and unbind a mouse button with messages and include a short description players can see by pressing <kbd>**\`**</kbd>.
{% endhint %}

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FgpZM1gVTVsdkb71XtAAg%2Fimage.png?alt=media&#x26;token=6772a557-0983-4be3-8201-1feb452f9151" alt="" width="305"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Details" %}

#### Bind Message

Select the message that will bind the rule's outgoing message to the selected mouse button. After it is received, the rule will send the messages every time the button is pressed/released.

#### Select Button

Select the button that is bound using this rule.

#### Description

Enter the description, which will be shown for the button when users press <kbd>\`</kbd> while playing.

#### Message to Send on Button Down

Select the message that will be sent when the button is pressed down.

#### Message to Send on Button Up

Select the message that will be sent when the button is released.

#### Unbind message

Select the message that will unbind the rule's outgoing message from the selected mouse button. After this message is received, the rule will NOT send the messages when the button is pressed/released.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sandbox.game/en/creator/game-maker/docs/game-rules/triggers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
