> For the complete documentation index, see [llms.txt](https://unfinishedstudios1.gitbook.io/fp-motion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unfinishedstudios1.gitbook.io/fp-motion/components/events/attempt.md).

# Attempt

## Methods

## Subscribe

<mark style="color:orange;">`PUT`</mark> `Subscribe(Event newEvent)`

Invoking this method will subscribe the parameter passed to the list of subscribers for this *Attempt*; these subscribers get invoked when it succeeds.

#### Path Parameters

| Name     | Type   | Description                                                                 |
| -------- | ------ | --------------------------------------------------------------------------- |
| NewEvent | object | Method we are trying to subscribe to this Attempt. Has to be of type Event. |

{% tabs %}
{% tab title="200 The method we wanted gets subscribed to the Attempt. Whenever it's attempted, the method will be invoked as well." %}

```csharp
private void OnShoot(){
    
}

private void Start(){
    PlayerEvents.Instance.Shoot.Subscribe(OnShoot);
}
```

{% endtab %}
{% endtabs %}

## Add Trier

<mark style="color:orange;">`PUT`</mark> `AddTrier(TryDelegate trier)`

Invoking this method will allow you to add a trier to the attempt; triers are functions of type bool that decide whether this attempt succeeds or not.

#### Path Parameters

| Name  | Type   | Description                                                                                         |
| ----- | ------ | --------------------------------------------------------------------------------------------------- |
| Trier | object | Function that will be added as a trier for the attempt. Can be any function that returns a boolean. |

{% tabs %}
{% tab title="200 In this case we are adding a trier for the jump attempt, and making sure that it is never allowed to successfully execute." %}

```csharp
private bool OnTry_Jump(){
    return false;
}

PlayerEvents.Jump.AddTrier(OnTry_Jump);
```

{% endtab %}
{% endtabs %}

## Methods

## Try

<mark style="color:green;">`POST`</mark> `Try()`

Invoking this method will try to invoke the listeners on the *Attempt,* but it will only do it if the trier allows for it.&#x20;

{% tabs %}
{% tab title="200 Trying the event is a really simple thing that can be done in one line, but it won't work unless its trier returns true." %}

```csharp
PlayerEvents.Jump.Try();
```

{% endtab %}
{% endtabs %}

## Debug

`OPTIONS` `Debug(bool debugAttempts = false, string name = "Debug")`

Logs the names of the methods subscribed to this Attempt, and the Triers added.

#### Path Parameters

| Name          | Type    | Description                                                                                               |
| ------------- | ------- | --------------------------------------------------------------------------------------------------------- |
| Name          | string  | Simple name that you can give this debug, making it easier to not confuse it when debugging other things. |
| DebugAttempts | boolean | ​Determines whether you want to debug the triers of this attempt, or only the listeners.                  |

{% tabs %}
{% tab title="200 " %}

```
PlayerEvents.Jump.Debug(false, false);
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://unfinishedstudios1.gitbook.io/fp-motion/components/events/attempt.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
