Sorry. The title may be misleading,but I was unsure how to phrase the issue. I created a plugin to write all my cool downs to a mini window. It consists of 3 triggers, 2 aliases, and a timer. The timer ticks ever 5 secs and sends the command "cd" to activate the triggers and capture the output. It seems that when the timer tics it sends an update command to my output window. The text is omitted because the triggers are set to do so, but it does trigger my prompt to display over and over again filling up my output window. Below is my complete code.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Plugin "cool_down" generated by Plugin Wizard -->
<muclient>
<plugin
name="cool_down"
author="Umiak"
id="c6dcb8a0fc4043d4a19fdcd9"
language="Lua"
save_state="y"
>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<triggers>
<!-- trigger to match start of inventory -->
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="Abilities on Cool Down:"
send_to="12"
sequence="100"
omit_from_output="y"
name="cd_start"
group="cooldown"
script="cooldown_table"
>
<send>
</send>
</trigger>
<!-- trigger to match an inventory line -->
<trigger
expand_variables="y"
keep_evaluating="y"
match="*"
send_to="12"
sequence="50"
omit_from_output="y"
name="cd_capture"
group="cooldown"
>
<send>
table.insert (cd_table, "%0")
</send>
</trigger>
<!-- trigger to match end of inventory -->
<trigger
expand_variables="y"
keep_evaluating="y"
match="(^<)|^$"
regexp="y"
send_to="12"
sequence="40"
name="cd_stop"
group="cooldown"
script="cooldown_process"
>
<send>
</send>
</trigger>
</triggers>
<aliases>
<alias
script="cd_off"
match="cdoff"
enabled="y"
send_to="12"
sequence="100"
group="CD"
>
<send>
</send>
</alias>
<alias
script="cd_on"
match="cdon"
enabled="y"
send_to="12"
sequence="100"
group="CD"
>
<send>
</send>
</alias>
</aliases>
<timers>
<timer
name="cooldown_tic"
enabled="n"
second="5"
omit_from_output="y"
>
<send>
cd
</send>
</timer>
</timers>
<!-- Script -->
<script>
<![CDATA[
require "wait" -- for waiting for cool down lines
require "movewindow" -- load the movewindow.lua module
win = GetPluginID () .. "_cooldown"
font = "f"
MIN_SIZE = 50
function cooldown_table (name, line, wildcards)
-- Create table to capture cool downs
cd_table = {}
-- Enable addtional triggers
EnableTrigger ("cd_capture", true)
EnableTrigger ("cd_stop", true)
EnableTimer("cooldown_tic", true)
end -- cooldown_table
function cooldown_process (name, line, wildcards, styles)
-- don't need to track inventories any more
EnableTrigger ("cd_capture", false)
EnableTrigger ("cd_stop", false)
-- in case no table yet
cd_table = cd_table or {}
table.sort (cd_table)
local font_height = WindowFontInfo (win, font, 1)
local max_width = WindowTextWidth (win, font, "Cool Downs!")
local window_width = max_width + 200
local window_height = font_height * (#cd_table + 2) + 10
-- make window correct size
WindowCreate (win,
windowinfo.window_left,
windowinfo.window_top,
window_width, window_height, -- width, height
windowinfo.window_mode,
windowinfo.window_flags,
ColourNameToRGB "black")
WindowRectOp (win, 5, 0, 0, 0, 0, 5, 15 + 0x1000)
-- add the drag handler so they can move the window around
movewindow.add_drag_handler (win, 0, 0, 0, font_height)
-- heading line
WindowText (win, font, "Cool Downs:", 5, 5, 0, 0, ColourNameToRGB "yellow")
-- draw each scan line
local y = font_height * 2 + 5
for i, value in ipairs (cd_table) do
local x = 5
x = x + WindowText (win, font, value, 5, y, 0, 0, ColourNameToRGB "lime")
y = y + font_height
end -- for each inventory item
WindowShow (win, true)
end -- cooldown_process
function OnPluginInstall ()
-- install the window movement handler, get back the window position
windowinfo = movewindow.install (win, 6) -- default to 6 (on top right)
-- make window so I can grab the font info
WindowCreate (win, 0, 0, 0, 0, 1, 0, 0)
-- add the font
WindowFont (win, font, "Lucida Console", 9)
end -- OnPluginInstall
function OnPluginSaveState ()
-- save window current location for next time
movewindow.save_state (win)
end -- function OnPluginSaveState
function cd_off(name, line, wildcards)
-- hide window
WindowShow (win, false)
ColourNote ("yellow", "", "Cool down window now hidden. Type 'cdon' to see it again.")
EnableTimer("cooldown_tic", false)
end --
function cd_on(name, line, wildcards)
-- show window
WindowShow (win, true)
ColourNote ("yellow", "", "Cool down window now shown. Type 'cdoff' to hide it.")
EnableTimer("cooldown_tic", true)
end --
]]>
</script>
</muclient>
|