GS2-Grade Script Trigger Reference

Reference for event triggers that call extended scripts

Trigger

changeGrade

grade changes

Synchronous Execution Script

The script is executed synchronously before the grade changes process.

Request
Type Description
namespace Namespace Namespace
gradeModel GradeModel Grade Model
status Status Status before change
afterStatus Status Status after change
Result
Type Required Default Value Limits Description
permit bool
Whether to allow grade changes
overrideGradeValue long
0 ~ 2147483645 Overriding grade value
Implementation Example
-- Request
local namespace = args.namespace
local gradeModel = args.gradeModel
local status = args.status
local afterStatus = args.afterStatus

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

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

Asynchronous Execution Script

The script is executed asynchronously after the grade changes process.

Request
Type Description
namespace Namespace Namespace
gradeModel GradeModel Grade Model
status Status Status
afterStatus Status Status after change
Implementation Example
-- Request
local namespace = args.namespace
local gradeModel = args.gradeModel
local status = args.status
local afterStatus = args.afterStatus

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

result = {
}