Auto-Login with Worlds
World bookmarks accept extra fields, so you can store the character per
world. Run this once (from /lua or init.lua; worlds persist in
rune.store):
rune.world.add("viking", "vikingmud.org:2001", { character = "Ragnar" })Then answer the login prompt from the bookmark of whatever you connected to:
local pending -- the character for the world we're dialing
rune.hooks.on("connecting", function(addr) pending = nil for _, w in ipairs(rune.world.list()) do local entry = rune.world.get(w.name) if entry.address == addr and entry.character then pending = entry.character end endend)
local function send_character() if pending then rune.send(pending) pending = nil -- fire once per connection endend
-- Cover both complete-line and partial-line login questions.rune.trigger.contains("What is your name", send_character)rune.trigger.contains("What is your name", send_character, { on = "prompt" })How it works
Section titled “How it works”- The
"connecting"hook receives the address being dialed.rune.world.list()returns only{name, address}, so the loop callsrune.world.get()for the full entry with the extra fields. - Clearing
pendingafter sending keeps the trigger inert if the phrase shows up again mid-session. - The two triggers cover both forms used by MUDs: a complete line and a partial line in the prompt overlay.
Passwords
Section titled “Passwords”Two options, in order of preference.
Read from the environment (recommended): keep the password in your
system keychain or an environment variable, never in Lua or store.json:
local password_sent = false
rune.hooks.on("connecting", function() password_sent = falseend)
local function send_password() if password_sent then return end local pw = os.getenv("MUD_PASSWORD") if pw then password_sent = true rune.send_raw(pw) endend
rune.trigger.contains("Password:", send_password)rune.trigger.contains("Password:", send_password, { on = "prompt" })send_raw skips command expansion, so a password containing ; or #
arrives intact. The guard handles repeated partial lines and prevents the
complete-line and prompt triggers from both sending. It resets for each
connection attempt.
Type it yourself: don’t automate the password line at all. The client already suppresses local echo while the server hides input, so nothing lands in your session log either way.
Avoid rune.store.set("password", ...). store.json is plaintext on
disk, and the convenience isn’t worth it.
Related: Storage & Worlds · Hooks & Events · Triggers