---
name: "setAttributes"
type: command
status: ok
groups: ["Strings", "Structured Text"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/setAttributes
revid: 351277
updated: 2023-11-27T02:34:49Z
---

# setAttributes

*Command · Strings, Structured Text · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

## Description

Returns a [Structured Text](../topics/Structured_Text.md) created from the given [structured](../topics/Structured_Text.md) text and sets [attributes](../topics/Structured_Text.md#attributes) to the given values.

> [!IMPORTANT]
> Even though command accepts plain [String](../topics/String.md) too, the argument should be [Structured Text](../topics/Structured_Text.md) in order for the set attributes to have an effect.
> Additionally the result of the command should be fed to [composeText](../commands/composeText.md) (See [#Example 1](../commands/setAttributes.md#example-1)) or [formatText](../commands/formatText.md).

## Syntax

```sqf
text setAttributes [name1, value1, name2, value2, ...]
```

**Parameters:**

- `text`: [String](../topics/String.md) or [Structured Text](../topics/Structured_Text.md) - only passing [Structured Text](../topics/Structured_Text.md) has any effect
- `nameN`: [String](../topics/String.md) - name of the attribute
- `valueN`: [String](../topics/String.md) - value of the attribute

**Returns:** [Structured Text](../topics/Structured_Text.md)

## Examples

### Example 1

```sqf
_txt = text "Red text, right align";
_txt setAttributes ["color", "#FF0000", "align", "right"];
hint composeText [_txt];
```

## See also

[composeText](../commands/composeText.md) · [formatText](../commands/formatText.md) · [parseText](../commands/parseText.md) · [text](../commands/text.md) · [ctrlSetStructuredText](../commands/ctrlSetStructuredText.md)

<sub>Source: [BI Community Wiki — setAttributes](https://community.bistudio.com/wiki/setAttributes) (revision 351277).</sub>
