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

# GS2-Idle Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### receive

Receiving rewards

**Related methods:**
receive - Receive rewards


#### Synchronous Execution Script

The script is executed synchronously before the receiving rewards process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| category | [CategoryModel](../sdk/#categorymodel) | Category Model |
| userId | string | User ID executing reward receive |
| status | [Status](../sdk/#status) | Status |
| acquireActions | [AcquireAction[]](../sdk/#acquireaction) | Rewards |
| config | [Config[]](../sdk/#config) | Configuration values applied to transaction variables |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow receiving rewards |
| rate | float |  | 1.0 | 0 ~ 1000 | Reward quantity multiplier |

##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local status = args.status
local acquireActions = args.acquireActions
local config = args.config

-- Business logic:
local permit = true
local rate = 1.0

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


#### Asynchronous Execution Script

The script is executed asynchronously after the receiving rewards process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| category | [CategoryModel](../sdk/#categorymodel) | Category Model |
| userId | string | User ID executing reward receive |
| oldStatus | [Status](../sdk/#status) | Status before receiving rewards |
| newStatus | [Status](../sdk/#status) | Status after receiving rewards |
| acquireActions | [AcquireAction[]](../sdk/#acquireaction) | Rewards |
| config | [Config[]](../sdk/#config) | Configuration values applied to transaction variables |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local category = args.category
local userId = args.userId
local oldStatus = args.oldStatus
local newStatus = args.newStatus
local acquireActions = args.acquireActions
local config = args.config

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  
### overrideAcquireActions

Script that dynamically determines the idle reward Acquire Action

**Related methods:**
receive - Receive rewards
receiveByUserId - Receive rewards by User ID


#### Synchronous Execution Script

After synchronously executing the Script that dynamically determines the idle reward Acquire Action, the Acquire Action is performed.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| categoryModel | [CategoryModel](../sdk/#categorymodel) | Category Model |
| userId | string | User ID |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| acquireActions | AcquireActionList[] | ✓ |  | 1 ~ 100 items | List of acquire actions for each waiting time<br>Assuming that the waiting time is "X minutes",<br>"X / rewardIntervalMinutes" will be the number of rewards that can be received, but by looping the elements specified in this array, different rewards can be given for each waiting time. |

##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local categoryModel = args.categoryModel
local userId = args.userId

-- Business logic:
local acquireActions = {}

-- Result
result = {
  acquireActions=acquireActions
}
```


---
  



