Securis

Character info

Securis is:
Mage 20, Bard 20, Geomancer 14, Geopath.

Mudlet scripts and triggers

This will supplement the output of score and nscore with a percentage, so you're never going to check help alignment descriptions again.

Example score:
nscore_alignment_example.png

Create a trigger with the following regex:

^(?:\+ )*You feel (.+), .+, and .+\.(?: *\+)*$

Script:
-------------------------------------
--  RetroMUD alignment percentage trigger
--
--  Author: Securis
--  Version: 1.1
-------------------------------------
--
-- This trigger adds alignment percentage output to the `score` and `nscore` lines.
-- Use the following trigger pattern to catch both:
--   ^(?:\+ )*You feel (.+), .+, and .+\.(?: *\+)*$
--
-- If you wish, you can customize the colours used below:
local ALIGNMENT_COLORS = {
  evil         = "<red>",
  neutral_evil = "<orange>",
  true_neutral = "<yellow>",
  neutral_good = "<cyan>",
  good         = "<green>",
}

-- Script proper below
local ALIGNMENT_DESCRIPTIONS = {
  -- Evil
  diabolical=1, fiendish=2, devilish=3, hellish=4, nefarious=5, villainous=6, malevolent=7, criminal=8, sinful=9, malicious=10, sinister=11, cruel=12, wicked=13, evil=14, heartless=15, spiteful=16, nasty=17, rude=18, mean=19, insensitive=20, callous=21, unfeeling=22, unpleasant=23, unkind=24, inconsiderate=25,
  -- Neutral
  unfair=26, prejudiced=27, intolerant=28, indifferent=29, apathetic=30, neutral=31, receptive=32, heedful=33, tolerant=34, impartial=35, fair=36,
  -- Good
  considerate=37, kind=38, pleasant=39, amiable=40, cordial=41, thoughtful=42, nice=43, agreeable=44, affable=45, genial=46, decent=47, good=48, righteous=49, compassionate=50, benign=51, charitable=52, virtuous=53, just=54, benevolent=55, heroic=56, beneficent=57, moral=58, heavenly=59, saintly=60, angelic=61,
}
local INDEX_MIN_NEUTRAL  = ALIGNMENT_DESCRIPTIONS["unfair"]
local INDEX_TRUE_NEUTRAL = ALIGNMENT_DESCRIPTIONS["neutral"]
local INDEX_MAX_NEUTRAL  = ALIGNMENT_DESCRIPTIONS["fair"]

local index = ALIGNMENT_DESCRIPTIONS[matches[2]]
if index == nil then
  printDebug("Unknown alignment: " .. matches[2])
  return
end

local color = ""
local str = ""
if index < INDEX_MIN_NEUTRAL then
  color = ALIGNMENT_COLORS["evil"]
  str = " (" .. (INDEX_MIN_NEUTRAL - index) * 4 .. "% evil)"
elseif index < INDEX_TRUE_NEUTRAL then
  color = ALIGNMENT_COLORS["neutral_evil"]
  str = " (" .. (INDEX_TRUE_NEUTRAL - index) * 20 .. "% neutral-evil)"
elseif index == INDEX_TRUE_NEUTRAL then
  color = ALIGNMENT_COLORS["true_neutral"]
  str = " (true neutral)"
elseif index <= INDEX_MAX_NEUTRAL then
  color = ALIGNMENT_COLORS["neutral_good"]
  str = " (" .. (index - INDEX_TRUE_NEUTRAL) * 20 .. "% neutral-good)"
else
  color = ALIGNMENT_COLORS["good"]
  str = " (" .. (index - INDEX_MAX_NEUTRAL) * 4 .. "% good)"
end
selectString(matches[2], 1)
creplace(color .. matches[2] .. str)

-- Fix nscore border by removing as many spaces as characters we've added
if selectSection(0,1) and getSelection() == "+" then
  local num_chars_added = #string.gsub(str, "<.->", "")
  for i = 1, num_chars_added do
    if selectSection(#getCurrentLine() - 2, 1) then replace("") end
  end
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License