Skip to content

Legion-Scripting

TazUO has implemented a scripting engine directly into the client.

You can access Legion Scripting by going to Top menu -> Legion Script

image

Legion Scripting setup guide

Legion API

Legion Script Recording

Legion Script Documentation.

Public Script Library set up here for people to contribute to.

ZIP Script Packages — bundle a script and its assets into a single .zip.

You can bind a Legion script directly to a hotkey. Right-click the script and choose Set Hotkey, then press the key combination you want. The binding is saved per script path and persists globally (across characters), and pressing the key toggles that script on and off. See Hotkeys.

You can also drive a script from a Spell Bar Script slot, which toggles the script and highlights green while it runs.

The Script Manager window remembers its size and position and restores them when reopened.

  • API.Virtue("justice") — the virtue API now supports justice in addition to honor, sacrifice, and valor.
  • API.OpenQuestLog() — opens the quest log gump.
  • API.OpenHelp() — opens the help menu.
  • API.Pathfind(x, y, z, distance, wait, timeout, run) and API.PathfindEntity(entity, distance, wait, timeout, run) — a new run parameter controls whether the character runs (default true) or walks along the path.
  • .IsParalyzed — a boolean property on mobile objects.
  • API.UpdateCooldown(name, maxValue, currentValue), API.RestartCooldown(name), API.DeleteCooldown(name) and API.CooldownExists(name) — manage cooldown bars created with API.CreateCooldownBar.
  • API.Gumps.CreateGumpTextBox(text, width, height, multiline, fontSize) — a new fontSize parameter (default 20) sizes the TTF font of the text input field, and ApiUiTtfTextInputField.FontSize exposes it as a property.
  • API.ActiveSpells(), API.ActiveSpellNames() and API.IsSpellActive(spell) — see which toggle spells/moves are currently active (the same ones the spell bar highlights).
  • API.ListRunningScripts() and API.IsScriptRunning(path). API.PlayScript, API.StopScript and API.ToggleScript now match scripts by their path relative to the LegionScripts folder, so scripts that share a file name are no longer ambiguous.
  • API.ContextMenu(serial, entry) — a string-based overload that selects a context menu entry by its text.
  • SetTooltip(text), SetEntityTooltip(serial) and ClearTooltip() on the base UI control, so scripts can attach plain-text or entity-property tooltips to any control. Setting a tooltip enables mouse input automatically, and a dedicated SetAcceptMouseInput(enabled) is also available.
  • Highlight(hue) on game objects and mobiles — sets a highlight hue (remembering the original so it can be restored with Highlight(None)); on mobiles it also recolors all equipped items.
image image image image

Bonus, Github Copilot can create scripts for you

Section titled “Bonus, Github Copilot can create scripts for you”
  1. Head over to the documentation you want to use(Links above)

  2. Login to Github

  3. Click this little copilot icon on the file:
    image

  4. Ask it to create a script:
    image

image

To start recording a script just hit Record Button, once you’re recording you will see each action under Recorded actions

image

You can pause and resume recording under your needs, move up/down or delete actions.

To finish script recording click Stop button.

You can choose to copy script or save it directly. Saved scripts will be displayed at Script manager:

image