-
Notifications
You must be signed in to change notification settings - Fork 2
/
Example_filters.lua
188 lines (147 loc) · 5.17 KB
/
Example_filters.lua
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
-- ---------------------------------------------------------------
-- Example Trigger filters (paste into "filter by" script box
-- in the trigger list).
-- ---------------------------------------------------------------
function send_to_script (name, trigger)
return trigger.send_to == sendto.script and
trigger.enabled
end -- send_to_script
function enabled (name, trigger)
return trigger.enabled
end -- enabled
function disabled (name, trigger)
return not trigger.enabled
end -- disabled
function keep_evaluating (name, trigger)
return trigger.keep_evaluating
end -- keep_evaluating
function badscript (name, trigger)
return not trigger.script_valid and
trigger.script ~= ""
end -- badscript
function temporary (name, trigger)
return trigger.temporary
end -- temporary
function matched (name, trigger)
return trigger.times_matched > 0
end -- matched
function unmatched (name, trigger)
return trigger.times_matched == 0
end -- unmatched
-- if they cancel, show everything
function everything (name, trigger)
return true
end -- everything
-- choose which function to use
result = utils.listbox ("Choose type of filtering", "Triggers",
{
send_to_script = "Send to script and enabled",
enabled = "Enabled items",
disabled = "Disabled items",
badscript = "Script name not found",
keep_evaluating = "Keep evaluating",
temporary = "Temporary triggers",
matched = "Ones that matched something",
unmatched = "Ones that never matched",
},
"badscript") -- default
-- use that function
filter = _G [result] or everything
-- ---------------------------------------------------------------
-- Example Alias filters (paste into "filter by" script box
-- in the alias list).
-- ---------------------------------------------------------------
function send_to_script (name, alias)
return alias.send_to == sendto.script and
alias.enabled
end -- send_to_script
function enabled (name, alias)
return alias.enabled
end -- enabled
function disabled (name, alias)
return not alias.enabled
end -- disabled
function keep_evaluating (name, alias)
return alias.keep_evaluating
end -- keep_evaluating
function badscript (name, alias)
return not alias.script_valid and
alias.script ~= ""
end -- badscript
function temporary (name, alias)
return alias.temporary
end -- temporary
function matched (name, alias)
return alias.times_matched > 0
end -- matched
function unmatched (name, alias)
return alias.times_matched == 0
end -- unmatched
-- if they cancel, show everything
function everything (name, alias)
return true
end -- everything
-- choose which function to use
result = utils.listbox ("Choose type of filtering", "Aliases",
{
send_to_script = "Send to script and enabled",
enabled = "Enabled items",
disabled = "Disabled items",
badscript = "Script name not found",
keep_evaluating = "Keep evaluating",
temporary = "Temporary aliases",
matched = "Ones that matched something",
unmatched = "Ones that never matched",
},
"badscript") -- default
-- use that function
filter = _G [result] or everything
-- ---------------------------------------------------------------
-- Example Timer filters (paste into "filter by" script box
-- in the timer list).
-- ---------------------------------------------------------------
function send_to_script (name, timer)
return timer.send_to == sendto.script and
timer.enabled
end -- send_to_script
function enabled (name, timer)
return timer.enabled
end -- enabled
function disabled (name, timer)
return not timer.enabled
end -- disabled
function one_shot (name, timer)
return timer.one_shot
end -- one_shot
function badscript (name, timer)
return not timer.script_valid and
timer.script ~= ""
end -- badscript
function temporary (name, timer)
return timer.temporary
end -- temporary
function fired (name, timer)
return timer.times_fired > 0
end -- fired
function not_fired (name, timer)
return timer.times_fired == 0
end -- not_fired
-- if they cancel, show everything
function everything (name, timer)
return true
end -- everything
-- choose which function to use
result = utils.listbox ("Choose type of filtering", "Timers",
{
send_to_script = "Send to script and enabled",
enabled = "Enabled items",
disabled = "Disabled items",
badscript = "Script name not found",
one_shot = "One-shot timers",
temporary = "Temporary timers",
fired = "Ones that fired",
not_fired = "Ones that never fired",
},
"badscript") -- default
-- use that function
filter = _G [result] or everything