-
Notifications
You must be signed in to change notification settings - Fork 16
/
Exits_Window.xml
123 lines (89 loc) · 2.43 KB
/
Exits_Window.xml
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- MuClient version 4.37 -->
<muclient>
<plugin
name="Exits_Window"
author="Nick Gammon"
id="fd1a20e303e48b78eceb103c"
language="Lua"
purpose="Redirects exits to a miniwindow"
date_written="2009-02-03 17:00"
requires="4.37"
version="1.0"
>
</plugin>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="Exits: *."
script="exits_line"
sequence="100"
>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
-- configuration
-- font
FONT_NAME = "Lucida Console"
FONT_SIZE = 9
-- where to put the window
WINDOW_POSITION = 4 -- see below (4 is top left)
--[[
Useful positions:
4 = top left
5 = center left-right at top
6 = top right
7 = on right, center top-bottom
8 = on right, at bottom
9 = center left-right at bottom
--]]
-- colours
WINDOW_BACKGROUND_COLOUR = ColourNameToRGB ("olivedrab")
WINDOW_TEXT_COLOUR = ColourNameToRGB ("#002800")
-- offset of text from edge
HORIZONTAL_OFFSET = 5
VERTICAL_OFFSET = 2
-- here on getting an exits line
function exits_line (name, line, wildcards, styles)
exits = line
width = WindowTextWidth (win, "f", exits)
-- make the window again the correct size
WindowCreate (win, 0, 0,
width + (HORIZONTAL_OFFSET * 2),
font_height + (VERTICAL_OFFSET * 2),
WINDOW_POSITION, 0,
WINDOW_BACKGROUND_COLOUR) -- create window
WindowText (win, "f", exits, HORIZONTAL_OFFSET, VERTICAL_OFFSET, 0, 0, WINDOW_TEXT_COLOUR)
-- show window
WindowShow (win, true) -- show it
end -- end exits_line
-- hide window on removal
function OnPluginClose ()
WindowShow (win, false) -- hide it
end -- OnPluginClose
-- hide window on disable
function OnPluginDisable ()
WindowShow (win, false) -- hide it
end -- OnPluginDisable
-- show window on enable
function OnPluginEnable ()
if exits then
WindowShow (win, true) -- show it
end -- if
end -- OnPluginEnable
-- startup stuff
win = GetPluginID () -- get a unique name
-- make the window with zero size to load the font into
WindowCreate (win, 0, 0, 0, 0, WINDOW_POSITION, 0,
WINDOW_BACKGROUND_COLOUR) -- create window
-- grab a font
WindowFont (win, "f", FONT_NAME, FONT_SIZE) -- define font
-- work out how high it is
font_height = WindowFontInfo (win, "f", 1) -- height of the font
]]>
</script>
</muclient>