# Achievements

These "recipes" give you examples of various achievements with different levels of complexity. All of them could be altered to apply to similar situations. Hopefully these will give you a better idea of what you can do with r4nkt.

## First Time Closer

For this example, we will imagine that we have an achievement that is to be awarded to your player the first time they close a sale.

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: close.sale
* name: Close a Sale

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: closed.a.sale
* name: Closed a Sale
* custom\_action\_id: close.sale
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: closed.a.sale
* name: Closed a Sale
* criteria (custom criteria IDs):
  * closed.a.sale

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: closed.a.sale

## Night Owl

For this example, we will imagine that we have an achievement that is to be awarded to your player when they post an article between midnight and 4 AM.

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: post.article
* name: Post Article

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: posted.article
* name: Posted Article
* custom\_action\_id: post.article
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: posted.article.in.middle.of.night
* name: Posted Article in the Middle of the Night
* criteria (custom criteria IDs):
  * posted.article
* criteria\_conditions:
  * groups:
    * conditions:
      * betweenHours:0,4

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: posted.article.in.middle.of.night

## Happy Birthday Tony Stark

For this example, we will imagine that we have an achievement that is to be awarded to your player when they schedule a meeting on [Tony Stark's](https://en.wikipedia.org/wiki/Tony_Stark_\(Marvel_Cinematic_Universe\)) birthday, May 29.

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: schedule.meeting
* name: Schedule Meeting

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: scheduled.meeting
* name: Scheduled Meeting
* custom\_action\_id: schedule.meeting
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: scheduled.meeting.on.tony.starks.birthday
* name: Scheduled Meeting on Tony Stark's Birthday
* criteria (custom criteria IDs):
  * scheduled.meeting
* criteria\_conditions:
  * groups:
    * conditions:
      * month:5
      * dayOfMonth:29

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: scheduled.meeting.on.tony.starks.birthday

## Trash Collector

Here we will imagine that we have an achievement that is to be awarded to your player when they delete 100+ files in a single day.

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: delete.file
* name: Delete File

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: deleted.100.files.in.single.day
* name: Deleted 100 Files in Single Day
* custom\_action\_id: delete.file
* type: sum
* rule: gte:100
* criteria\_conditions:
  * groups:
    * conditions:
      * sameDay

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: deleted.100.files.in.single.day
* name: Deleted 100 Files in Single Day
* criteria (custom criteria IDs):
  * deleted.100.files.in.single.day

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: deleted.100.files.in.single.day

## One Week Wonder

Here we will imagine that we have an achievement that is to be awarded to your player when they log in to your game each day of a given week.

{% hint style="warning" %}
Note that this will define when a player has performed the action for each day of a single week...that is, Sunday through Saturday. This is not the same as performing an action for seven straight days, nor is it the same as performing an action on each day of the week, but not necessarily the same week.
{% endhint %}

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: log.in
* name: Log In

#### Criteria

Seven criteria are required for this recipe, one for each day of the week.  They should like like the following, but with adjustments made to `custom_id`, `name`, and `rule` for each respective day of the week:

* custom\_id: logged.in.on.sunday
* name: Logged In on Sunday
* custom\_action\_id: log.in
* type: sum
* rule: gte:1
* criteria\_conditions:
  * groups:
    * conditions:
      * dayOfWeek:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: logged.in.each.day.of.week.for.one.week
* name: Logged in each Day of Week for One Week
* criteria (custom criteria IDs):
  * logged.in.on.sunday
  * logged.in.on.monday
  * logged.in.on.tuesday
  * logged.in.on.wednesday
  * logged.in.on.thursday
  * logged.in.on.friday
  * logged.in.on.saturday
* criteria\_conditions:
  * groups:
    * conditions:
      * sameWeek

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: logged.in.each.day.of.week.for.one.week

## 6-Digits Club

Here we will imagine that we have an achievement that is to be awarded to your player when they close a sale for $100,000 or more.

{% hint style="warning" %}
This recipe requires that whenever you report that your player has closed a sale that the price is attached via the activity's `custom_data` field.
{% endhint %}

### Ingredients

#### Actions

* custom\_id: close.sale
* name: Close a Sale

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: closed.a.sale
* name: Closed a Sale
* custom\_action\_id: close.sale
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: closed.a.sale.for.100000.or.more
* name: Closed a Sale for 100000+
* criteria (custom criteria IDs):
  * closed.a.sale
* criteria\_conditions:
  * groups:
    * conditions:
      * activityData:price,gte,1000

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: closed.a.sale.for.100000.or.more

## Repeat Business

Here we will imagine that we have an achievement that is to be awarded to your player when they sell a car to a customer for the second time.

{% hint style="warning" %}
This recipe requires that whenever you report that your player has sold a car that the customer ID is attached via the activity's `custom_data` field.
{% endhint %}

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: sell.car
* name: Sell a Car

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: sold.at.least.two.cars
* name: Sold at least Two Cars
* custom\_action\_id: sell.car
* type: sum
* rule: gte:2

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: sold.a.second.car.to.same.customer
* name: Sold a second Car to the Same Customer
* criteria (custom criteria IDs):
  * sold.at.least.two.cars
* criteria\_conditions:
  * groups:
    * conditions:
      * activityData:customer.id,eq,{activity.customer.id}

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: sold.a.second.car.to.same.customer

## Twenty-Something

Here we will imagine that we have an achievement that is to be awarded to your player when they enroll someone in their 20s.

{% hint style="warning" %}
This recipe requires that whenever you report that your player has enrolled someone that the age of the enrollee is attached via the activity's `custom_data` field.
{% endhint %}

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: enroll.person
* name: Enroll Person

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: enrolled.person
* name: Enrolled Person
* custom\_action\_id: enroll.person
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: enrolled.twenty.something
* name: Enrolled Twenty-Something
* criteria (custom criteria IDs):
  * enrolled.person
* criteria\_conditions:
  * groups:
    * conditions:
      * activityData:customer.age,gte,20
      * activityData:customer.age,lt,30

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: enrolled.twenty.something

## Birthday Boss Beater

Here we will imagine that we have an achievement that is to be awarded to your player when they defeat the boss at the end of the game on their birthday.

{% hint style="warning" %}
This recipe requires that whenever you store your player's birthday in the player resource's `custom_data` field.
{% endhint %}

### Ingredients

#### Actions

Only one action is required with the following properties:

* custom\_id: defeat.boss
* name: Defeat Boss

#### Criteria

Only one criterion is required with the following properties:

* custom\_id: defeated.boss
* name: Defeated Boss
* custom\_action\_id: defeat.boss
* type: sum
* rule: gte:1

#### Criteria Groups

Only one criteria group is required with the following properties:

* custom\_id: defeated.boss.on.birthday
* name: Defeated Boss on Birthday
* criteria (custom criteria IDs):
  * defeated.boss
* criteria\_conditions:
  * groups:
    * conditions:
      * month:{player.birthday.month}
      * dayOfMonth:{player.birthday.day}

#### Achievements

Your achievement should have the following properties:

* custom\_criteria\_group\_id: defeated.boss.on.birthday


---

# 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.r4nkt.com/cookbook/achievements.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.
