So, I'm revisiting this map window thing I was working on. It works and works well. But I'm not savvy enough with what's going on to figure out what I need to do to make the change I'm after.
<triggers>
<trigger
enabled="y"
match="^\-\-\-.+? v\d+ \-\-\-+$"
name="MapWindow"
omit_from_output="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>require "wait"
wait.make (function ()
local win = "MapWindow"
local font = "body"
local map = {}
if not WindowInfo (win, 1) then
WindowCreate (win, 670, 0, 380, 400, 6, 2, ColourNameToRGB("black"))
WindowFont (win, font, "Courier New", 10)
end
while true do
local line, wildcards, styles = wait.regexp ("^(.*)$", 0, trigger_flag.OmitFromOutput)
if string.match (line, "^(-)(-)(-)") then
break
end
table.insert (map, styles)
end
local font_height = WindowFontInfo (win, font, 1)
WindowCreate (win, 670, 0, 380, 400, 6, 2, ColourNameToRGB "black")
local y = font_height * 2
for i, styles in ipairs (map) do
local x = 0
for _, style in ipairs (styles) do
x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
end
y = y + font_height
end
WindowShow (win, true)
end)</send>
</trigger>
</triggers>
This is what I came away with after watching Nick's tutorial. Right or wrong, it works.
Two things I'd like to know how to do:
First, I'd like to have the lines being matched on at start and end to also show up in the miniwindow, retaining style. Right now they don't show up in either the main window or the miniwindow.
Second, for a related map (aetherspace in Lusternia), I would like to capture background color as well as the font style.
The first one seems a minor matter of dealing with code that I'm just not familiar enough with. My best guess with the second one is that styles doesn't carry background color information, and I'll have to draw in the colors manually. I'm hoping I'm wrong about that. |