Hi,
the Braille Reader plugin gave me the idea that I could also put otherimportant text from the MUD output in a separate miniwindow, to keep pretty repititive but important info like the prompt out of the general output (also reduces amount of text I need to read in the braille reader miniwindow). My idea was to create a window at the bottom right, which contains the prompt info I need. To achieve that, I created another plugin, and copied most of the Braille Reader window settings over (at least what I considered relevant for my miniwindow). Maybe I made a mistake, maybe I'm still missing a required part, or maybe the positioning of the miniwindow doesn't work this way -- either way, the text of the miniwindow is showing nowhere onscreen. Maybe you could assist me in finding a good position for the window, or tell me which mistake I made setting up the window?
Here's the plugin:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 22, 2019, 6:55 -->
<!-- MuClient version 5.05 -->
<!-- Plugin "Prompt_Miniwindow" generated by Plugin Wizard -->
<muclient>
<plugin
name="Prompt_Miniwindow"
author="Tim Böttcher"
id="3413610b552f5d5eadd25052"
language="Lua"
purpose="Show the MUD prompt in a miniwindow. Erase from output."
date_written="2019-07-22 18:53:47"
requires="5.05"
version="1.0"
>
<description>
<![CDATA[
This plugin gets the prompt of the MUD and removes it from the output, instead displaying it in a miniwindow.
This is useful for me as a deafblind user of the Braille Reader plugin; Maybe it's useful to others as well.
To customize,
- change the value of the trigger's match attribute to match your MUD's prompt.
- change the outputstring variable below at the start of the script.
- insert all expected wildcards in the parameters of s:format (see below).
For each wildcard, there must be a %s in the outputstring variable, or %q if you want the wildcard to appear in quotes.
Example:
match="^(\d+)\/(\d+) h (.*)$"
outputstring = "%s/%s hp|%q"
local text = outputstring:format (wildcards[1], wildcards[2], wildcards[3])
Would match:
60/300 h Not Poisoned
And lead to the output:
60/300 hp|"Not Poisoned"
]]>
</description>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^[EXT=(.*) HNG=(\d+)] (\d+)\/(\d+)h, (\d+)\/(\d+)m (.*)$"
omit_from_output="y"
regexp="y"
repeat="y"
script="UpdatePromptMiniwindow"
sequence="100"
>
</trigger>
</triggers>
<script>
<![CDATA[
outputstring = "EXT=%s HNG=%s %s/%sh %s/%sm %s" -- Change the format of the output here.
-- Internal stuff.
text_colour = ColourNameToRGB ("white")
background_colour = ColourNameToRGB ("Black")
win = "test_" .. GetPluginID ()
font = "f"
function UpdatePromptMiniwindow (name, line, wildcards)
WindowRectOp(win, miniwin.rect_fill, 0, 0, 0, 0, background_colour, 0)
local text = outputstring:format (wildcards[1], wildcards[2], wildcards[3], wildcards[4], wildcards[5], wildcards[6], wildcards[7])
WindowText (win, font, text, 5, 5, 0, 0, text_colour, false)
end -- function
function OnPluginInstall ()
TextRectangle(0, 0, 0, -50, 10, ColourNameToRGB("gray"), 2, ColourNameToRGB("silver"), miniwin.brush_solid)
WindowCreate(win, 0, 0, 0, 0, miniwin.pos_bottom_right, 0, background_colour)
WindowFont(win, font, "Courier", 14)
width = WindowTextWidth(win, font, string.rep ("M", "80"))
height = WindowFontInfo (win, font, 1)
WindowCreate (win, 0, 0, width + 10, height + 10, miniwin.pos_bottom_right, 0, background_colour)
WindowShow (win, true)
end -- function
]]>
</script>
</muclient>
|