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

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

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



## 트리거

### start



**관련 메서드:**
startStateMachineByUserId - 사용자 ID를 지정하여 스테이트 머신 시작


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |
| parameters | string | 스테이트 머신에 전달할 인자 |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 시작을 허용할지 여부 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId
local parameters = args.parameters

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}
```


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |
| parameters | string | 스테이트 머신에 전달할 인자 |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId
local parameters = args.parameters

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

result = {
}
```


---
  
### pass



**관련 메서드:**
emit - 스테이트 머신에 이벤트 전송
emitByUserId - 사용자 ID를 지정하여 스테이트 머신에 이벤트 전송
report - 스테이트 머신에 복수 이벤트 보고
reportByUserId - 사용자 ID를 지정하여 스테이트 머신에 복수 이벤트 보고


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 스테이트 머신의 정상 종료를 허용할지 여부 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}
```


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId

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

result = {
}
```


---
  
### error



**관련 메서드:**
emit - 스테이트 머신에 이벤트 전송
emitByUserId - 사용자 ID를 지정하여 스테이트 머신에 이벤트 전송
report - 스테이트 머신에 복수 이벤트 보고
reportByUserId - 사용자 ID를 지정하여 스테이트 머신에 복수 이벤트 보고


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |

##### Result

|  | 타입 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | 스테이트 머신의 비정상 종료를 허용할지 여부 |

##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId

-- Business logic:
local permit = true

-- Result
result = {
  permit=permit
}
```


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

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

##### Request

| | 타입 | 설명 |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | 네임스페이스 |
| stateMachineMaster | [StateMachineMaster](../sdk/#statemachinemaster) | 스테이트 머신 마스터 데이터 |
| status | [Status](../sdk/#status) | 상태 |
| userId | string | 사용자 ID |


##### 구현 예제


**Lua**
```lua

-- Request
local namespace = args.namespace
local stateMachineMaster = args.stateMachineMaster
local status = args.status
local userId = args.userId

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

result = {
}
```


---
  



