In each of your triggers that omits from output, for example
<trigger
enabled="y"
match="You say '*'"
script="chats"
omit_from_output="y"
sequence="100"
></trigger>
Change it to, for example
<trigger
enabled="y"
match="You say '*'"
script="chats"
omit_from_output="y"
sequence="100"
send_to="12"
><send>StopEvaluatingTriggers(true)</send></trigger>
Then change all ColourTell/ColourNote to use Simulate instead.
Instead of:
for _, v in ipairs(styles) do
ColourTell(RGBColourToName(v.textcolour), RGBColourToName(v.backcolour), v.text)
end -- for each style run
Note ("") -- wrap up line
We use:
Simulate(stylesToANSI(styles).."\r\n")
That part (the stylesToANSI function) unfortunately does not have built in support, because there is no MUSHclient function that properly converts from style runs to ansi. So I make my own. (The above part would be extra trivial if this next part were just built into MUSHclient. hint hint!)
function init_ansi()
ANSI_colours = {
[GetNormalColour (BLACK)] = ANSI(0,30),
[GetNormalColour (RED)] = ANSI(0,31),
[GetNormalColour (GREEN)] = ANSI(0,32),
[GetNormalColour (YELLOW)] = ANSI(0,33),
[GetNormalColour (BLUE)] = ANSI(0,34),
[GetNormalColour (MAGENTA)] = ANSI(0,35),
[GetNormalColour (CYAN)] = ANSI(0,36),
[GetNormalColour (WHITE)] = ANSI(0,37),
[GetBoldColour (BLACK)] = ANSI(1,30),
[GetBoldColour (RED)] = ANSI(1,31),
[GetBoldColour (GREEN)] = ANSI(1,32),
[GetBoldColour (YELLOW)] = ANSI(1,33),
[GetBoldColour (BLUE)] = ANSI(1,34),
[GetBoldColour (MAGENTA)] = ANSI(1,35),
[GetBoldColour (CYAN)] = ANSI(1,36),
[GetBoldColour (WHITE)] = ANSI(1,37)
} -- end conversion table
end
init_ansi()
-- also provide the reverse of the extended_colours global table
colours_extended = {}
for i,v in ipairs(extended_colours) do
colours_extended[v] = i
end
-- Returns a string with embedded ansi codes.
-- This can get confused if the player has redefined their color chart.
function stylesToANSI (styles)
local line = {}
local reinit = true
for _,v in ipairs (styles) do
if ANSI_colours[v.textcolour] then
table.insert(line, ANSI_colours[v.textcolour])
elseif colours_extended[v.textcolour] then -- use 256 color xterm ansi when necessary
table.insert(line, ANSI(38,5,colours_extended[v.textcolour]))
elseif reinit then -- limit performance damage
reinit = false
init_ansi()
end
table.insert(line, v.text)
end
table.insert(line, ANSI(0))
return table.concat(line)
end
|