Guides

Mudlet Trigger Basics for First-Time Scripters

Mudlet becomes much more useful once you move repetitive tasks into triggers and aliases. This guide walks through a small starter package you can adapt for almost any MUD.

30 minutes5 steps
1

Create a package folder for your profile

Open the trigger editor and create a parent folder such as 'Starter Pack'. Keeping aliases, triggers, and scripts under one folder makes it easier to export or disable later.

⚠ Common Pitfalls

  • Adding everything at the root level makes troubleshooting harder once the profile grows.
  • Mixing game-specific and universal helpers in one folder causes accidental trigger overlap.
2

Add a highlight trigger for important text

Create a regex trigger that highlights a line you always want to notice, such as low health warnings or tells from other players.

-- Pattern example
^Your wounds are severe\.$

-- Script example
selectCurrentLine()
fg('red')
bg('black')
resetFormat()

⚠ Common Pitfalls

  • Unescaped punctuation in regex patterns can match more than intended.
  • Highlight triggers should not also send commands unless you clearly separate responsibilities.
3

Create one helper alias for a repeated action

Add a short alias for a command sequence you type often, such as checking score, inventory, and room exits after combat.

-- Alias pattern
^qs$

-- Script
sendAll('score', 'inventory', 'exits')

⚠ Common Pitfalls

  • Avoid aliases that shadow common words you may type in chat.
  • Test the alias slowly first so you do not spam commands into rate limits.
4

Move reusable logic into a named script

When two or more triggers do the same thing, store the shared behavior in a script function. This makes your package easier to maintain and reduces copy-paste errors.

StarterPack = StarterPack or {}

function StarterPack.echoNotice(message)
  cecho(string.format('<green>[notice]</green> %s\n', message))
end

⚠ Common Pitfalls

  • Global variables with generic names can clash with plugins or future packages.
  • Copying the same formatting logic into multiple triggers makes later edits tedious.
5

Test and export the package

Trigger each alias or pattern from real game output, then export the parent folder as a package backup. A tiny exported package is the fastest way to keep progress safe and share scripts with friends.

Quick validation list:
1. Fire each trigger once from live output
2. Confirm aliases send the intended commands
3. Disable the package and reconnect
4. Re-enable and confirm behavior returns
5. Export the folder to a package file

What you built

With one folder, one trigger, one alias, and one shared script, you already have the structure of a maintainable Mudlet profile. Add new automation slowly and name everything clearly so future debugging stays easy.