-
Notifications
You must be signed in to change notification settings - Fork 15
/
Combat_Text.xml
119 lines (83 loc) · 2.26 KB
/
Combat_Text.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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- MuClient version 4.37 -->
<muclient>
<plugin
name="Combat_Text"
author="Nick Gammon"
id="4de91eaa2624f202c4bb6837"
language="Lua"
purpose="Shows messages in the middle of the output window"
date_written="2009-02-08 14:00"
requires="4.37"
version="1.0"
>
</plugin>
<!-- Aliases -->
<aliases>
<alias
script="combat_message"
match="combat_message *"
enabled="y"
sequence="100"
>
</alias>
</aliases>
<!-- Timers -->
<timers>
<timer script="remove_message"
second="5.00"
active_closed="y"
name="remove_message"
>
</timer>
</timers>
<!-- Script -->
<script>
<![CDATA[
-- configuration
-- font
FONT_NAME = "Arial Black"
FONT_SIZE = 30
TEXT_COLOUR = ColourNameToRGB ("yellow")
BACKGROUND_COLOUR = ColourNameToRGB ("darkred")
-- where to put the window
WINDOW_POSITION = 12 -- centered
OFFSET = 5 -- gap inside box
-- what sound to play
SOUND_FILE = "/Windows/Media/Windows XP Balloon.wav"
-- alias goes here
function combat_message (name, line, wildcards)
message = wildcards [1]
width = WindowTextWidth (win, "f", message)
-- make the window
WindowCreate (win, 0, 0,
width + (OFFSET * 2),
font_height + (OFFSET * 2),
WINDOW_POSITION, 0,
BACKGROUND_COLOUR) -- create window
WindowText (win, "f", message, OFFSET, OFFSET, 0, 0, TEXT_COLOUR)
WindowRectOp (win, 1, 0, 0, 0, 0, TEXT_COLOUR)
-- show window
WindowShow (win, true) -- show it
-- play a warning sound
Sound (SOUND_FILE)
-- enable and reset the timer which removes the message
EnableTimer ("remove_message")
ResetTimer ("remove_message")
end -- end combat_message
-- here to remove the message
function remove_message ()
WindowShow (win, false)
end -- remove_message
-- startup stuff
win = GetPluginID () -- get a unique name
-- make the window
WindowCreate (win, 0, 0, 0, 0, WINDOW_POSITION, 0, 0x000000) -- 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>