GS2-Experience Script Trigger Reference

Reference of event triggers that call extended scripts

Trigger

rankCapScript

obtaining rank caps

Synchronous Execution Script

The script is executed synchronously before the obtaining rank caps process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
userIdstringUser ID
propertyIdstringProperty ID
A developer-defined identifier that uniquely identifies this status within the user’s scope. It is recommended to use a value that appends an experience model suffix to the GS2-Inventory Item Set GRN or GS2-Dictionary Entry GRN that possesses the experience.
Result
TypeRequiredDefaultValue LimitsDescription
rankCaplong
0 ~ 2147483645rank cap
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local userId = args.userId
local propertyId = args.propertyId

-- Business logic:
local rankCap = 0

-- Result
result = {
  rankCap=rankCap
}

changeExperience

experience value changes

Synchronous Execution Script

The script is executed synchronously before the experience value changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
statusStatusStatus before change
afterStatusStatusStatus after change
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow experience value changes
overrideExperienceValuelong
0 ~ 2147483645Overriding experience value
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus

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

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

Asynchronous Execution Script

The script is executed asynchronously after the experience value changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
oldStatusStatusStatus before change
statusStatusStatus
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local oldStatus = args.oldStatus
local status = args.status

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

result = {
}

changeRank

rank changes

Synchronous Execution Script

The script is executed synchronously before the rank changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
statusStatusStatus before change
afterStatusStatusStatus after change
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow rank changes
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}

Asynchronous Execution Script

The script is executed asynchronously after the rank changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
oldStatusStatusStatus before change
statusStatusStatus
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local oldStatus = args.oldStatus
local status = args.status

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

result = {
}

changeRankCap

Rank cap changes

Synchronous Execution Script

The script is executed synchronously before the rank cap changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
statusStatusStatus before change
afterStatusStatusStatus after change
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow rank cap change
overrideRankCapValuelong
0 ~ 2147483645New rank cap
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local afterStatus = args.afterStatus

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

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

Asynchronous Execution Script

The script is executed asynchronously after the rank cap changes process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
statusStatusStatus
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status

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

result = {
}

overflowExperience

Experience overflow

Synchronous Execution Script

The script is executed synchronously before the experience overflow process.

Request
TypeDescription
namespaceNamespaceNamespace
experienceModelExperienceModelExperience Model
statusStatusStatus
overflowExperienceValuelongExperience overflow value
Result
TypeRequiredDefaultValue LimitsDescription
permitbool
Whether to allow experience overflow
Implementation Example
-- Request
local namespace = args.namespace
local experienceModel = args.experienceModel
local status = args.status
local overflowExperienceValue = args.overflowExperienceValue

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}