Posted by
| Nick Gammon
Australia (23,100 posts) Bio
Forum Administrator |
Message
| One problem I see is that this will only show the current value, and it won't update (unless you are planning to put this inside a timer). Infoboxes, as far as I know, are for gauges rather than pure text (I could be wrong about that).
This timer I developed shows how you can just display the various variables you mention, in a small miniwindow. It updates every second, so it should show the current information.
<timers>
<timer enabled="y" second="1.00" send_to="12"
>
<send>
require "var"
-- make window if required
if not setup_target_window then
target_win = GetPluginID () .. ":targets" -- get a unique name
WindowCreate (target_win , 0, 0, 200, 55, 6, 0, ColourNameToRGB("whitesmoke")) -- create window
WindowFont (target_win, "f", "FixedSys", 9) -- define font
target_font_height = WindowFontInfo (target_win , "f", 1)
setup_target_window = true
end -- if first time
-- blank existing window contents
WindowRectOp (target_win, 2, 0, 0, 0, 0, WindowInfo (target_win, 9))
-- framing rectangle
WindowRectOp (target_win, 5, 0, 0, 0, 0, 5, 15)
-- variables for text position (the top updates as we move down)
local left = 5
local top = 5
-- kill target
WindowText (target_win, "f", "KT: " .. (var.kill_target or "none"),
left, top, 0, 0, ColourNameToRGB("green"))
top = top + target_font_height
-- heal target
WindowText (target_win, "f", "HT: " .. (var.heal_target or "none"),
left, top, 0, 0, ColourNameToRGB("blue"))
top = top + target_font_height
-- debate target
WindowText (target_win, "f", "DT: " .. (var.debate_target or "none"),
left, top, 0, 0, ColourNameToRGB("orange"))
-- make visible, or refresh if already visible
WindowShow (target_win , true)
</send>
</timer>
</timers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|