> For the complete documentation index, see [llms.txt](https://dirkscripts.gitbook.io/dirkscripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dirkscripts.gitbook.io/dirkscripts-documentation/resources/dirk-multichar/exports.md).

# Exports

## `setCharacterState`

Apply one of the configured [Character States](/dirkscripts-documentation/resources/dirk-multichar/features/character-states.md) to a specific character.

```lua
exports.dirk_multichar:setCharacterState(charId, stateName, payload?)
```

| Argument    | Type   | Purpose                                                                                                                                                                |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `charId`    | string | The internal character ID.                                                                                                                                             |
| `stateName` | string | Must match one of the states configured in the **States** tab of the [Live Script Configurator](/dirkscripts-documentation/resources/dirk-multichar/configuration.md). |
| `payload`   | table? | Optional extra data shown to the player alongside the state (e.g. `{ endsAt = os.time() + 900 }` for a timed state).                                                   |

***

## `registerLifestyle`

Register a Lua-side lifestyle at runtime. Useful when an external resource wants to surface its own lifestyle entries without admins manually adding them to the configurator.

```lua
exports.dirk_multichar:registerLifestyle('mylifestyle', {
  label = 'My Lifestyle',
  description = 'A short description for the player.',
  items = {
    { name = 'phone', amount = 1 },
    { name = 'wallet', amount = 1 },
  },
  -- additional fields mirror what's in the configurator's Lifestyles tab
})
```

| Argument | Type   | Purpose                                                               |
| -------- | ------ | --------------------------------------------------------------------- |
| `id`     | string | Unique key for the lifestyle. Used internally to reference the entry. |
| `data`   | table  | Lifestyle definition matching the configurator's data shape.          |

Registered lifestyles appear in the player's lifestyle picker alongside admin-configured ones.

***

> The scriptConfig system itself is read from external code via `lib.scriptConfig.get('section')` and `lib.scriptConfig.on('section', cb)`. See [dirk\_lib's scriptConfig docs](/dirkscripts-documentation/resources/dirk-lib/modules/scriptconfig.md) for the full API.
