Cube Scripts

Renaming Items

Items can be given a custom label from the inventory UI. Renaming stores the new label in the item's metadata.label, so it is unique to that specific item stack and persists with the item.

Usage#

Open the context menu of an item in the inventory and choose the rename option. A modal prompts for the new name, using the rename_item and item_name locale strings.

The client sends the requested label to the server, which validates it before applying it to the item metadata.

Behaviour#

  • The new label is written to metadata.label on the target slot.
  • Server-side validation trims surrounding whitespace, collapses repeated spaces, rejects empty labels, blocks control and formatting characters, and caps the length.
  • A rejected label leaves the item unchanged.

Localisation#

The prompt text is provided by your active locale file.

json
{
  "rename_item": "Rename item",
  "item_name": "Item name"
}
Note

Because the label lives in metadata, two stacks of the same item with different labels will not stack together.