> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Grade 스크립트 트리거 레퍼런스

확장 스크립트를 호출하는 이벤트 트리거의 레퍼런스



## 트리거

### changeGrade



**관련 메서드:**
addGradeByUserId - 사용자 ID를 지정하여 그레이드 가산
subGrade - 그레이드 감산
subGradeByUserId - 사용자 ID를 지정하여 그레이드 감산
setGradeByUserId - 누적 획득 그레이드 설정


#### 동기 실행 스크립트

 처리 전에, 스크립트가 동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| gradeModel | [GradeModel](../sdk/#grademodel) | 그레이드 모델 |
| status | [Status](../sdk/#status) | 변화 전 상태 |
| afterStatus | [Status](../sdk/#status) | 변화 후 상태 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 그레이드 변화를 허용할지 여부 |
| overrideGradeValue | long | ✓ |  | 0 ~ 2147483645 | 덮어쓸 그레이드 값 |

##### 구현 예제


**Lua**
```lua

-- 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
}
```


#### 비동기 실행 스크립트

 처리 후에, 스크립트가 비동기 실행됩니다.

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| gradeModel | [GradeModel](../sdk/#grademodel) | 그레이드 모델 |
| status | [Status](../sdk/#status) | 상태 |
| afterStatus | [Status](../sdk/#status) | 변화 후 상태 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local gradeModel = args.gradeModel
local status = args.status
local afterStatus = args.afterStatus

-- 비동기 스크립트는 일반적으로 API 응답에 영향을 주지 않습니다.
-- 로그 출력이나 분석, 외부 알림 등에 사용됩니다.

result = {
}
```


---
  



