# Activity: Add Points / Add Gems & Diamonds

This activity is giving fixed or dynamically calculated amount of points/gems/diamonds to the player.

In case of points you can decide if the amount will be given to current balance, balance of levels progress and leaderboard progress.

<figure><img src="/files/BBxXm3vuHWP7QGcBMZuR" alt=""><figcaption></figcaption></figure>

You can also calculate amount of points/gems/diamonds based on the event to which activity is connect and optional to user user state function. This will require basic knowledge of JavaScript.

<figure><img src="/files/rpAZZFd7jizzoZvkJ40I" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/x5BWj78cvyezXTfXGU8J" alt=""><figcaption></figcaption></figure>

You can write JavaScript for the function and define user state and event, that can be used for testing.

Button "Test points function" will give you immediate result, so you can verify your definition before enabling activity for end users.

For example, following function will give 10% of deposit amount as number of points, in case total lifetime deposit amount of player is above 1000. Otherwise it will give 5% of deposit amount. Results will be rounded to the higher value, e.g. if calculated amount is 10.3 points, then we will give 11

```javascript
(function () {
    var result = 0;
    if (state.acc_total_deposit_amount >= 1000) {
        result = event.acc_last_deposit_amount * 0.10;
    } else {
        result = event.acc_last_deposit_amount * 0.05
    }
    return Math.ceil(result);
})()
```


---

# 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://help.smartico.ai/welcome/products/crm-automation/activities-of-flows/activity-add-points.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.
