# Achievements

**Support**

Use this to determine if you can implement achievements for your game on the current platform.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FtIX6lGTCKeetI3lvIQ4X%2FScreenshot%202024-12-09%20at%2019.46.23.png?alt=media&#x26;token=bbdea18a-61bb-4888-9e4b-1a8878ab4a5f" alt=""><figcaption></figcaption></figure>

Check if getting list of achievements is supported.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FBuCfk7xmntTGpCW5gvTR%2FScreenshot%202024-12-09%20at%2019.48.34.png?alt=media&#x26;token=41e24dba-dbdc-4f20-9242-6fb57a6de6a5" alt=""><figcaption></figcaption></figure>

Check if built-in popup is supported.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FJkajOjPk72stgJDtSwvL%2FScreenshot%202024-12-09%20at%2019.49.14.png?alt=media&#x26;token=b7aa8e1f-c11c-4f37-8a64-14b41aa8908e" alt=""><figcaption></figcaption></figure>

#### Unlock achievement <a href="#purchase" id="purchase"></a>

Unlocks achievement for a player.

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FW3SYGz9Q4UfT7Y22wlbb%2FScreenshot%202024-12-09%20at%2020.12.06.png?alt=media&#x26;token=159ea451-2439-46a9-a296-6065c62e398a" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"y8\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"achievementkey\"","value":"\"YOUR_ACHIEVEMENT_KEY\""}},{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"achievement\"","value":"\"YOUR_ACHIEVEMENT_NAME\""}}]},{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"lagged\""}}],"actions":[{"id":"add-action-parameter","objectClass":"PlaygamaBridge","parameters":{"key":"\"achievement\"","value":"\"YOUR_ACHIEVEMENT_ID\""}}]},{"eventType":"block","conditions":[],"actions":[{"id":"achievements-unlock","objectClass":"PlaygamaBridge"}]}]},{"eventType":"block","conditions":[{"id":"on-achievements-unlock-completed","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"success"}]}]}
```

</details>

**Get List**

Returns the achievement list in JSON

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2FMtfEr8pZRHcDTW9lclG0%2FScreenshot%202024-12-09%20at%2020.08.42.png?alt=media&#x26;token=95aa9664-728c-416b-9bac-3562ef0262e7" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"achievements-get-list","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-achievements-get-list-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.AchievementsCount","comparison":4,"second-value":"0"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"items\"","start-index":"0","end-index":"PlaygamaBridge.AchievementsCount - 1"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"PlaygamaBridge.PlatformId","comparison":0,"second-value":"\"y8\""}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Achievement ID: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"achievementid\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Achievement Name: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"achievement\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Achievement Key: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"achievementkey\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Description: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"description\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Icon: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"icon\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Difficulty: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"difficulty\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Secret: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"secret\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Awarded: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"awarded\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Game: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"game\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Link: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"link\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Player ID: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"playerid\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Player Name: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"playername\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Last Updated: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"lastupdated\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Date: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"date\")"}},{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"\"Relative Date: \" & PlaygamaBridge.AchievementPropertyValue(loopindex(\"items\"), \"rdate\")"}}]}]}]}]}]}
```

</details>

**Show Native Popup**

Some platforms support built-in achievement list which is shown in overlay

<figure><img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9EZjJDI1Z0WkhX3FfIOD%2FScreenshot%202024-12-09%20at%2020.16.34.png?alt=media&#x26;token=89ad35a1-8fcb-4226-88bf-ffba83cd7128" alt=""><figcaption></figcaption></figure>

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"achievements-show-native-popup","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-achievements-show-native-popup-completed","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"success"}]}]}
```

</details>


---

# 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://wiki.playgama.com/playgama/sdk/engines/construct-3/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.
