-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrack.xml
More file actions
188 lines (168 loc) · 3.81 KB
/
track.xml
File metadata and controls
188 lines (168 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, May 31, 2019, 6:10 PM -->
<!-- MuClient version 5.06 -->
<!-- Plugin "track" generated by Plugin Wizard -->
<muclient>
<plugin
name="track"
author="Kloke"
id="781c94cb64446457846cd334"
language="Lua"
purpose="highlight words - track add <thing> in a lovely colour"
date_written="2019-05-31 18:08:55"
requires="5.00"
version="1.1"
sequence="1"
save_state="y"
>
<description trim="y">
<![CDATA[
highlight the current track phrase. Usage:
track Show tracked items
track add <item> Add an item to tracked items
track remove <item> Remove item from tracked items
track clear Clear all tracked items
]]>
</description>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
custom_colour="17"
enabled="y"
ignore_case="y"
keep_evaluating="y"
name="trackthing"
expand_variables="y"
regexp="y"
repeat="y"
sequence="100"
other_text_colour="red"
match="(@!trackthing)"
>
</trigger>
</triggers>
<!-- Aliases -->
<aliases>
<!-- Add item to track. -->
<alias
match="track add *"
enabled="y"
send_to="12"
sequence="100"
script="AddTrackedItem"
>
</alias>
<!-- List tracked items. -->
<alias
match="track"
enabled="y"
send_to="12"
sequence="100"
script="trackShow"
>
</alias>
<!-- Remove tracked item -->
<alias
match="track remove *"
enabled="y"
send_to="12"
sequence="100"
script="RemoveTrackeItem"
>
</alias>
<!-- Clear all tracked items. -->
<alias
match="track clear"
enabled="y"
send_to="12"
sequence="100"
script="ClearAllTrackedItems"
>
</alias>
</aliases>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="track help"
enabled="y"
>
</alias>
<alias
script="ShowSortedTrack"
match="track sort"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
require "tprint"
require "serialize"
TrackedItems = {}
local trackthing = ""
function OnHelp ()
world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
function AddTrackedItem (name,line,wildcards)
local Track = wildcards[1]
table.insert (TrackedItems, Track)
CreateTrackVariable ()
end -- function
-- Create the track variable from the map
trackthing = ""
TrackedItems = {}
function CreateTrackVariable ()
trackthing = ""
for k, v in pairs (TrackedItems) do
--Note ("Debug: k: ".. k .. " v: " .. v)
if (trackthing == "") then
trackthing = trackthing .. v
else
trackthing = trackthing .. "|" .. v
end -- if
end -- for
trackShow ()
SetVariable ("trackthing", trackthing)
SetChanged (true)
end -- function CreateTrackVariable
function trackShow ()
--Note (GetVariable("trackthing") or "Nothing")
ColourNote ("red", "black", trackthing)
end -- function trackShow
-- Remove tracked item.
function RemoveTrackeItem (name,line,wildcards)
for k, v in pairs (TrackedItems) do
--Note ("Debug: k: ".. k .. " v: " .. v)
if (wildcards[1] == v) then
table.remove (TrackedItems, k)
end -- if
end -- for
CreateTrackVariable ()
trackShow ()
end -- function RemoveTrackeItem
-- Clear all tracked items.
function ClearAllTrackedItems (name,line,wildcards)
TrackedItems = {}
trackthing = ""
SetVariable ("trackthing", trackthing)
SetChanged (true)
end -- function ClearAllTrackedItems
function OnPluginInstall ()
assert (loadstring (GetVariable ("TrackedItems") or "")) ()
end -- function OnPluginInstall
function OnPluginSaveState ()
--tprint (TrackedItems)
if (next (TrackedItems) ~= nil) then
SetVariable ("TrackedItems", "TrackedItems = " .. serialize.save_simple (TrackedItems))
end -- if
end -- function OnPluginSaveState
function ShowSortedTrack ()
table.sort (TrackedItems)
table.foreachi (TrackedItems, print)
end -- ShowSortedTrack
]]>
</script>
</muclient>