GS2-Idle Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

receive

Receiving rewards

Synchronous Execution Script

The script is executed synchronously before the receiving rewards process.

Request
TypeDescription
namespaceNamespaceNamespace
categoryCategoryModelCategory Model
userIdstringUser ID executing reward receive
statusStatusStatus
acquireActionsAcquireAction[]Rewards
configConfig[]Set values to be applied to transaction variables
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow receiving rewards
ratefloat1.00 ~ 1000Acquisition quantity rate
Implementation Example
-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local status = args.status
local acquireActions = args.acquireActions
local config = args.config

-- Business logic:
local permit = true
local rate = 0

-- Result
result = {
  permit=permit,
  rate=rate
}

Asynchronous Execution Script

The script is executed asynchronously after the receiving rewards process.

Request
TypeDescription
namespaceNamespaceNamespace
categoryCategoryModelCategory Model
userIdstringUser ID executing reward receive
oldStatusStatusStatus before receiving rewards
newStatusStatusStatus after receiving rewards
acquireActionsAcquireAction[]Rewards
configConfig[]Set values to be applied to transaction variables
Implementation Example
-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local oldStatus = args.oldStatus
local newStatus = args.newStatus
local acquireActions = args.acquireActions
local config = args.config

-- Asynchronous scripts typically do not affect the API response.
-- Use for logging, analytics, external notifications, etc.

result = {
}

overrideAcquireActions

Script that dynamically determines the idle reward Acquire Action

Synchronous Execution Script

After synchronously executing the Script that dynamically determines the idle reward Acquire Action, the Acquire Action is performed.

Request
TypeDescription
namespaceNamespaceNamespace
categoryModelCategoryModelCategory Model
userIdstringUser ID
Result
TypeRequiredDefaultValue LimitsDescription
acquireActionsAcquireActionList[]
1 ~ 100 itemsList of acquire actions for each waiting time
Assuming that the waiting time is “X minutes”,
“X / rewardIntervalMinutes” will be the number of rewards that can be received, but by looping the elements specified in this array, different rewards can be given for each waiting time.
Implementation Example
-- Request
local namespace = args.namespace
local categoryModel = args.categoryModel
local userId = args.userId

-- Business logic:
local acquireActions = {}

-- Result
result = {
  acquireActions=acquireActions
}