Skip to content

LuaUI Encrypt

wezzzyrek1 edited this page Sep 18, 2026 · 3 revisions

Lua UI - Encrypting scripts

A small Windows tool that turns your plain .lua window scripts into the encrypted .usc files a live client loads, so players never receive readable source. It ships with LuaUI Ext.

In dev mode a client reads plain .lua. A live client reads only .usc - the same scripts, encrypted with your key (see File map). This tool does the encrypting.

Keep your .lua - encryption is one-way

The tool only encrypts. There is no way to turn a .usc back into .lua.

Encrypt a copy and keep the plain .lua as your working source. If you lose it, the script is gone - you would be rewriting it from scratch. Treat the .usc as a build output, never as your only copy.

This matters more than it sounds: a live client deletes every .lua it finds in its script folder on start-up (see File map). Copy your working folder into a client that has dev mode off and the sources are gone. Keep them somewhere the client never looks.

The key

.usc files are packed with a 32-character key, and it must be the same key the server hands the client - LuaUIScriptKey in Data\Plugins\PluginSettings.ini. If the two differ the client cannot read your scripts, and the window silently does nothing on a live server.

The tool keeps the key in its own config.ini, next to the exe, so you set it once:

[Config]
LuaUIScriptKey=<your 32-character key>
ToolDefaultMode=LuaUI

The LuaUIScriptKey field in the window shows it and writes it back when you change it, and the tool opens in the mode you used last.

Encrypting

  1. Pick Lua UI at the bottom of the window. This is what routes a .lua to .usc with your key.
  2. Check the LuaUIScriptKey field matches your server's LuaUIScriptKey.
  3. Drag your files - or a whole folder - onto the window, or use Choose file. A folder is walked for every script inside and you get one summary at the end, instead of a dialog per file. A single file gives you Open / Copy buttons for the result.

Then drop the .usc into the client's script folder in place of the .lua, and ship without the .lua. On a live server the client loads the .usc; keep the plain .lua on your own machine for dev mode.

Which files to encrypt

Everything a live client requires or auto-loads as a window:

  • UI\UI.lua, UI\Registry.lua, UI\Net.lua, UI\Protocol.lua, UI\Enums.lua
  • UI\Windows\*.lua
  • SimpleXml.lua

Dropping the whole UI\ folder on the tool does all of these in one pass.

Notes

  • .usc is the user-script format, packed with your own key. The tool's other modes make formats other systems read - see Encrypting files for custom maps and monsters; for Lua UI you want the Lua UI mode.
  • An empty file is reported as "file is empty" rather than a vague failure.

See Also

  • File map - .usc vs .lua, and how the client chooses
  • Lua UI - LuaUIScriptKey and turning the system on

Clone this wiki locally