GS2-AdReward Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

acquirePoint

Point acquisition

Synchronous Execution Script

The script is executed synchronously before the point acquisition process.

Request
TypeDescription
namespaceNamespaceNamespace
pointPointPoint before acquisition processing
acquirePointValuelongAmount of points to be acquired
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow point acquisition
overridePointValuelong0 ~ 2147483645Amount of points to override the acquisition value
Implementation Example
-- Request
local namespace = args.namespace
local point = args.point
local acquirePointValue = args.acquirePointValue

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

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

Asynchronous Execution Script

The script is executed asynchronously after the point acquisition process.

Request
TypeDescription
namespaceNamespaceNamespace
pointPointPoint before acquisition processing
afterPointPointPoint after acquisition processing
acquirePointValuelongAmount of points to be acquired
Implementation Example
-- Request
local namespace = args.namespace
local point = args.point
local afterPoint = args.afterPoint
local acquirePointValue = args.acquirePointValue

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

result = {
}

consumePoint

Point consumption

Synchronous Execution Script

The script is executed synchronously before the point consumption process.

Request
TypeDescription
namespaceNamespaceNamespace
pointPointPoint before consumption processing
consumePointValuelongAmount of points to be consumed
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow point consumption
overridePointValuelong0 ~ 2147483645Amount of points to override the consumption value
Implementation Example
-- Request
local namespace = args.namespace
local point = args.point
local consumePointValue = args.consumePointValue

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

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

Asynchronous Execution Script

The script is executed asynchronously after the point consumption process.

Request
TypeDescription
namespaceNamespaceNamespace
pointPointPoint before consumption processing
afterPointPointPoint after consumption processing
consumePointValuelongAmount of points to be consumed
Implementation Example
-- Request
local namespace = args.namespace
local point = args.point
local afterPoint = args.afterPoint
local consumePointValue = args.consumePointValue

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

result = {
}