For the complete documentation index, see llms.txt. This page is also available as Markdown.

Daily Rewards

You are reading the documentation for Bridge SDK v2. If you need the obsolete v1 documentation, see Documentation (v1).

Daily login rewards: the game declares an ordered list of reward ids (one per day), and Bridge tracks the current day, claims, and streak resets.

Configuration

Declare the rewards in the config under the dailyRewards key:

{
    "dailyRewards": {
        "rewards": ["100_coins", "200_coins", "1_gem", "300_coins", "2_gems", "500_coins", "5_gems"],
        "cycle": true,        // optional, default true — restart from day 1 after the last reward
        "resetOnMiss": true   // optional, default true — reset the streak when a day is missed
    }
}

Get Rewards

Returns the configured ordered list of reward ids.

const rewards = await bridge.dailyRewards.getRewards() // string[]
Bridge.dailyRewards.GetRewards((success, rewards) =>
{
    if (success)
    {
        // rewards is an ordered string[] of reward ids
    }
});

Call the Daily Rewards Get Rewards action, then handle the On Daily Rewards Get Rewards Completed trigger. Read the result with the DailyRewardsCount and DailyRewardsReward(index) expressions, or take the whole list with DailyRewardsAsJSON.

Copy This Example
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"daily-rewards-get-rewards","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-daily-rewards-get-rewards-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"rewards\"","start-index":"0","end-index":"PlaygamaBridge.DailyRewardsCount - 1"}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.DailyRewardsReward(loopindex(\"rewards\"))"}}]}]}]}

Call the Daily Rewards Get Rewards action, then handle the On Daily Rewards Get Rewards Completed condition. Read the result with the PlaygamaBridge::DailyRewardsCount() and PlaygamaBridge::DailyRewardId(index) expressions, or take the whole list with PlaygamaBridge::DailyRewardsAsJSON().

Copy This Example
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::DailyRewardsGetRewards"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnDailyRewardsGetRewardsCompleted"},"parameters":["",""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["CurrentIndex","=","0"]}],"events":[{"type":"BuiltinCommonInstructions::Repeat","repeatExpression":"PlaygamaBridge::DailyRewardsCount()","conditions":[],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::DailyRewardId(CurrentIndex)","\"info\"",""]},{"type":{"value":"SetNumberVariable"},"parameters":["CurrentIndex","+","1"]}]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
Bridge.daily_rewards.get_rewards(funcref(self, "_on_get_rewards_completed"))

func _on_get_rewards_completed(success, rewards):
    if success:
        for reward in rewards:
            print(reward)
Bridge.daily_rewards.get_rewards(Callable(self, "_on_get_rewards_completed"))

func _on_get_rewards_completed(success, rewards):
    if success:
        for reward in rewards:
            print(reward)

Get Current Day

Returns the 0-based index (into the rewards list) of the reward the player is currently on.

Call the Daily Rewards Get Current Day action, then handle the On Daily Rewards Get Current Day Completed trigger and read the DailyRewardsCurrentDay expression.

Copy This Example

Call the Daily Rewards Get Current Day action, then handle the On Daily Rewards Get Current Day Completed condition and read the PlaygamaBridge::DailyRewardsCurrentDay() expression.

Copy This Example

Get Current Reward

Returns the id of the reward claimable today, or null when nothing can be claimed (already claimed today, or the streak is finished and cycle is off).

Call the Daily Rewards Get Current Reward action, then handle the On Daily Rewards Get Current Reward Completed trigger. The Is Daily Rewards Current Reward Available condition tells whether anything can be claimed; read the id with the DailyRewardsCurrentReward expression.

Copy This Example

Call the Daily Rewards Get Current Reward action, then handle the On Daily Rewards Get Current Reward Completed condition and read the PlaygamaBridge::DailyRewardsCurrentReward() expression (empty string when nothing can be claimed).

Copy This Example

Claim Current Reward

Claims today's reward. Resolves to true on success and advances the streak, or false when nothing is claimable.

Call the Daily Rewards Claim Current Reward action, then handle the On Daily Rewards Claim Current Reward Completed trigger — Is Last Action Completed Successfully is true only when the reward was actually claimed.

Copy This Example

Call the Daily Rewards Claim Current Reward action, then handle the On Daily Rewards Claim Current Reward Completed condition — Is Last Action Completed Successfully is true only when the reward was actually claimed.

Copy This Example

Last updated