You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
3.9 KiB

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, December 28, 2018, 7:21 PM -->
<!-- MuClient version 5.06-pre -->
<!-- Plugin "Aard_Highlight_Info_History" generated by Plugin Wizard -->
<muclient>
<plugin
name="Aard_Highlight_Info_History"
author="Endymion"
id="bc54cb349c89079ee13da16a"
language="Lua"
purpose="Highlight info lines containing specific words."
date_written="2018-12-28 19:20:08"
requires="4.30"
version="1.0"
>
<description trim="y">
<![CDATA[
This plugin will highlight info -h containing your Name by default.
Alternatively you can temporarily change it by sending the following command:
info -h <type> <word/words to match>
e.g. info -h pk endymion
You can set the highlight colo r with the following command:
info -h color <color>
color can be either a name or hex value
e.g. info -h color yellow
e.g. info -h color #0000ee
]]>
</description>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="^\[[\d:\s\w]+\] INFO: .*Endymion.*$"
name="info_highlight"
omit_from_output="y"
regexp="y"
script="highlight_line"
ignore_case="yes"
sequence="100"
>
</trigger>
<trigger
enabled="y"
name="end_of_info"
match="^\{end_of_info\}$"
regexp="y"
script="reset"
sequence="100"
>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<alias
match="^info \-h (\w+)( (?<words>.+))?$"
enabled="y"
regexp="y"
script="go"
sequence="100"
>
</alias>
<alias
match="^info \-h color (?<color>.+)$"
enabled="y"
regexp="y"
script="set_color"
sequence="99"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
require "gmcphelper"
local color = GetVariable("color") or "yellow"
local count = -1
local do_reset = false
function my_name()
local me = gmcp("char.base.name")
return me
end
function set_color(name, line, args)
color = args.color
ColourNote("darkred", "", "[", "red", "", "[", "silver", "", " Setting info -h highlight color to ", color, "", color, "silver", "", ". ", "red", "", "]", "darkred", "", "]")
SaveState()
end
function go(name, line, args)
count = 0
do_reset = false
if args.words ~= "" then
do_reset = true
ColourNote("darkred", "", "[", "red", "", "[", "silver", "", " Highlighting info history lines that contain '"..args[2].."'. ", "red", "", "]", "darkred", "", "]")
Note()
SetTriggerOption("info_highlight", "match", "^\\[[\\d:\\s\\w]+\\] INFO: .*"..args[2]..".*$")
end
EnableTrigger("end_of_info", true)
DoAfterSpecial(1, "send_it('"..args[1].."')", 12)
end
function send_it(w)
SendNoEcho("info -h "..w)
SendNoEcho("echo {end_of_info}")
end
function highlight_line(name, line, args)
count = count + 1
ColourNote(color, "", args[0])
end
function reset()
local me = my_name()
if not me then
Note("Error getting player name from gmcp.")
return
end
if count == 1 then
ColourNote("darkred", "", "[", "red", "", "[ ", "silver", "", count.." line highlighted. ", "red", "", "]", "darkred", "", "]")
elseif count >= 0 then
ColourNote("darkred", "", "[", "red", "", "[ ", "silver", "", count.." lines highlighted. ", "red", "", "]", "darkred", "", "]")
end
if do_reset then
ColourNote("darkred", "", "[", "red", "", "[", "silver", "", " Resetting info -h highlight to "..me..". ", "red", "", "]", "darkred", "", "]")
SetTriggerOption("info_highlight", "match", "^\\[[\\d:\\s\\w]+\\] INFO: .*"..me..".*$")
end
EnableTrigger("end_of_info", false)
end
function OnPluginSaveState()
SetVariable("color", color)
end
function loaded()
Note()
ColourNote("darkred", "", "[", "red", "", "[\n\n", "silver", "", GetPluginInfo(GetPluginID(), 3), "red", "", "\n\n]", "darkred", "", "]")
Note()
reset()
end
DoAfterSpecial(.2, "loaded()", 12)
]]>
</script>
</muclient>