--- title: set_value summary: MD assignment and counter increment forms observed in this project. section: reference kind: api status: reference tags: ["X4","modding","set","value"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/"] --- ## Return value | Type | Meaning | | --- | --- | | [none (MD action)](wiki:type-md-values) | Writes an MD variable; its value type depends on the expression and attributes. | [Types and methods](wiki:types) ## Assignment Layer: Mission Director actions. `name` is the variable path, `exact` is the value expression and `operation`, when present, selects how to apply it. Examples initialize a string, number and table. ```xml ``` **What happens:** In the current MD context, $Label = "example", $Revision = 0 and $Records is an empty MD table. Nothing is logged. ## Increment a revision The counter must already exist with the appropriate type. Initialization and migration of saved state require their own design. ```xml ``` **What happens:** If $Revision is 0 after initialization, it becomes 1; this changes the variable in the stated context. ## Scope `$Revision` in the current context and `Init.$Revision` are not necessarily the same variable. For instantiated handlers, distinguish request-local data from a shared registry. This is not the full attribute reference; check the XSD and game behavior for new forms. See [MD variables](wiki:md-variables) and [migrations](wiki:md-persistence).