Skip to Content
defold-typescript libraries
megalanthusdefold-gamepush

megalanthus/defold-gamepush/gamepush.core.triggers

GamePush triggers: list them, check activation and claim their rewards, with their events.

  • GitHub: megalanthus/defold-gamepush — pinned to v1.4.1
    1. Pick a release from megalanthus/defold-gamepush releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as core_triggers from "gamepush.core.triggers"

Functions

claim(parameters: Record<string, unknown>, callback?: (result: unknown) => void)

Claims a trigger's reward. Raises when the table is missing.

Parameters

  • parameters: Record<string, unknown> — The options for the SDK's triggers.claim.
  • callback?: (result: unknown) => void — Receives the result.

list(): Record<string, unknown>[]

All triggers.

Returns

  • Record<string, unknown>[]

activated_list(): Record<string, unknown>[]

The triggers the player activated.

Returns

  • Record<string, unknown>[]

get_trigger(id_or_tag: string): Record<string, unknown>

A trigger's description. Raises unless id_or_tag is a string.

Parameters

  • id_or_tag: string — The trigger's id or tag.

Returns

  • Record<string, unknown>

is_activated(id_or_tag: string): boolean

Whether the player activated a trigger. Raises unless id_or_tag is a string.

Parameters

  • id_or_tag: string — The trigger's id or tag.

Returns

  • boolean

is_claimed(id_or_tag: string | number): boolean

Whether a trigger's reward was given.

Parameters

  • id_or_tag: string | number — The trigger's id or tag.

Returns

  • boolean

Variables

callbacks: TriggersCallbacks

The trigger event handlers.

Types

TriggersCallbacks

TriggersCallbacks.activate?: (trigger: unknown) => void

A trigger was activated.

TriggersCallbacks.claim?: (trigger: unknown) => void

A trigger's reward was given.

TriggersCallbacks.error_claim?: (error: unknown) => void

Giving a trigger's reward failed.

On this page