Skip to main content

Mod file changes

The File changes tab is where you define what your mod changes on target servers.

For each file change, set:

  • target path
  • change type
  • content/script payload

Supported change types include replace, merge variants, and delete behavior.

You can also:

  • reorder file changes (move up/down)
  • preview the generated diff before publishing

Preview caveat:

  • preview is file-focused and uses the first selected map plus default configuration values, so final server output can differ

Execution order matters, so keep file changes intentionally ordered.

Dynamic Variables

Each file change has a Dynamic Variables toggle. When enabled, the file content (and the file path) are processed as a Latte template before being written to the server. This lets you make your mod configurable and reusable.

Disable Dynamic Variables for large static files (e.g. object placement files) that do not use any template syntax — processing very large files through the template engine can cause issues.

Available variables

The following variables are always available when Dynamic Variables is on:

VariableValue
{$installation_id}Unique numeric ID for this specific installation instance
{$manager_url}Shop URL for the target server (e.g. https://example.dzbot.de)

In addition, every configuration field you define in the Configuration tab becomes a variable using its identifier as the variable name. If your mod has a config field with identifier spawn_location, it is available as {$spawn_location} in all file contents and paths.

Template syntax

The template engine supports a sandbox-restricted subset of the Latte template language. For full language documentation, see the official Latte docs.

Variable output

{$variable}
{$variable|filter}
{= expression}

Filters

Filters transform a variable's value inline. Append them with |:

{$name|upper}           → uppercase
{$name|lower} → lowercase
{$name|capitalize} → Capitalize First Letter
{$name|trim} → strip whitespace
{$name|replace: 'a', 'b'}
{$name|truncate: 20}
{$items|implode: ','} → join array to string
{$csv|explode: ','} → split string to array

Other available filters: firstUpper, length, reverse, slice, sort, join, split, date, number, round, ceil, floor, clamp, padLeft, padRight, substr, stripTags, repeat, webalize.

Conditionals

{if $condition}
...
{elseif $other}
...
{else}
...
{/if}

Loops

{foreach $items as $item}
{$item}
{/foreach}

{for $i = 0; $i < 10; $i++}
{$i}
{/for}

{while $condition}
...
{/while}

Variable assignment

{var $label = 'Hello'}
{default $limit = 100}

{var} always sets the variable. {default} only sets it when it is not already defined.

Other constructs

{* this is a comment and will not appear in the output *}

{= 2 + 2} → outputs 4
{spaceless}...{/spaceless} → strips whitespace between tags
{try}...{/try} → silently catches rendering errors in the block
{l} {r} → literal { and } characters

Allowed PHP functions

Two PHP functions are available for use inside expressions:

  • explode(separator, string) — split a string into an array
  • implode(glue, array) — join an array into a string

Built-in Latte functions

clamp(value, min, max), divisibleby(value, by), even(number), odd(number), first(array), last(array), slice(array, start, length)

Variable paths

When Dynamic Variables is on, the file path is also processed as a template. All variables available in the file content work in the path field as well.

This is most useful when installing the same mod multiple times on one server — without unique paths, each installation would overwrite the same file. Using {$installation_id} in the path gives each installation its own file:

custom/my-custom-file-{$installation_id}.json

Every installation gets a uniquely named file, so multiple instances can coexist on the same server without conflict.

Editor intelligence

The file content editor is a full Latte-aware IDE. When Dynamic Variables is enabled the editor activates several assistive features:

Autocomplete

  • Type {$ to get a list of all variables in scope, including variables introduced by surrounding {foreach} and {for} blocks as well as any {var} / {default} declarations above the cursor. Selecting an object-typed variable (e.g. a coordinate field) automatically inserts bracket notation {$spawn_location["..."]} with the cursor between the quotes and property suggestions already open.
  • Type [" after an object variable to get property key suggestions (e.g. {$spawn_location[" offers x, z, y, radius).
  • Type | inside a tag to get a list of supported filters.
  • Type { to get a list of Latte tag snippets.
Bracket notation required

In Latte/PHP, . is the string concatenation operator — using {$coord.x} does not access the x property and instead causes an "array to string conversion" error. Always use bracket notation: {$coord["x"]}.

Hover documentation

Hovering the cursor over any $variable, |filter, or {tag} shows an inline tooltip with its type, description, or usage hint.

Inline diagnostics

The editor continuously validates template expressions and underlines problems:

  • Undefined variable names are flagged as warnings.
  • Dot notation on any variable (e.g. {$coord.x}) is flagged as an error with a suggestion to use $coord["x"] instead.
  • Unrecognised filter names are flagged.

Folding

Matching tag pairs ({if}/{/if}, {foreach}/{/foreach}, {for}/{/for}, {while}/{/while}, {switch}/{/switch}, {capture}/{/capture}, {try}/{/try}, {spaceless}/{/spaceless}) can be collapsed in the editor gutter.

Scope awareness

Variables introduced inside a {foreach} block (the loop item and the built-in {$iterator}) are only suggested inside that block. {$iterator} provides first, last, counter, counter0, odd, even, total, and parent for nested loops. Variables declared with {var} or {default} are available from their declaration line downward.