Legion Scripting — ZIP File Support
Legion Scripting — ZIP File Support
Section titled “Legion Scripting — ZIP File Support”Overview
Section titled “Overview”You can now distribute complete script libraries as a single .zip file. Drop it in your LegionScripts/ folder and TazUO will load scripts and textures directly from the archive — no extraction needed.
ZIP Structure
Section titled “ZIP Structure”MyLibrary.zip├── GroupName/│ ├── SubGroup/│ │ └── myscript.py│ └── another.py└── images/ └── mybutton.png ← named texture (any folder)- Scripts must be
.pyor.cs - Max 2 levels of grouping (
Group/SubGroup/script.py) — deeper entries are skipped - Files or folders starting with
_or.are ignored (e.g.__pycache__,.DS_Store) API.pyis always skipped
Using PNG Textures in Scripts
Section titled “Using PNG Textures in Scripts”Any PNG in the zip is registered as a named texture, accessible by:
- Full entry path:
images/mybutton.png - Filename only:
mybutton.png(first match wins if names collide)
In a scripted gump
Section titled “In a scripted gump”# LegionTextureControl(name, width=0, height=0)# width/height default to the image's natural sizeimg = API.Gumps.LegionTextureControl("mybutton.png")gump.AddControl(img)
# Resize if neededimg2 = API.Gumps.LegionTextureControl("images/mybutton.png", 64, 64)gump.AddControl(img2)Change texture at runtime
Section titled “Change texture at runtime”img.TextureName = "other_image.png"Deleting ZIP Scripts
Section titled “Deleting ZIP Scripts”Right-clicking a zip-sourced script in the Script Manager shows a 3-option dialog:
| Option | Effect |
|---|---|
| Delete Script Only | Removes just that .py/.cs entry from inside the zip |
| Delete Entire Zip | Deletes the whole .zip file and unloads all its scripts |
| Cancel | Does nothing |
Rename, Edit Externally, and Open Location are hidden for zip scripts — they don’t apply to entries inside an archive.
Limitations
Section titled “Limitations”- Scripts inside zips cannot import other scripts via relative paths; use the zip’s own module structure via
sys.path(the zip itself is added automatically) - Editing a zip script via the in-game Constants Editor writes back into the zip correctly
- Textures are loaded at script-load time; reloading scripts reloads textures