Set variable initial value
set_variableInitialize a variable to a fixed value at game start by inserting or updating a variable set event in the start scene's onInit script. Requires the variable to already exist.
Instructions
Ensure a variable is initialised to value at game start by inserting/updating a VARIABLE_SET_TO_VALUE event at the top of the START SCENE's onInit script (GB Studio 4.x has no default-value field on Variable). Value must fit signed 16-bit (-32768..32767). The variable must already exist — to add a new variable, call create_variable first. For in-game variable changes during play, use patch_script instead.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"variableId": "<variableId>",
"value": "<value>"
},
"name": "set_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | ||
| variableId | Yes | Variable id (UUID). |