Loselessly transposing output to miniwindow?

Posted by VBMeireles on Tue 14 Sep 2010 07:42 PM — 5 posts, 20,226 views.

Brazil #0
What I'm trying to do is having the whole "score" output transposed to a miniwindow at the side.

At the moment I have one trigger to each line of the score that, upon matching the sentence, omits it from output while printing it to the miniwindow at the prefixed position.

However, even though the score is color coded, it's all being transposed in plain white color, as I'm just using %0 to get the expression.

I'd like to know the simplest workaround (even if the simplest is still complex) to simply transpose the output text, using the same colors etc, to the miniwindow.
Australia Forum Administrator #1
See this:

http://gammon.com.au/forum/?id=9965

That shows copying an inventory to a miniwindow, retaining colours (you effectively have to copy the style runs). However it is quite short. It also shows how you can omit from output.

Basically doing a "score" would be almost identical, except for the initial command you send, and how you detect the start and end of the stuff you want to copy.
Brazil #2
Thanks! It is a little more complex than I expected, though.

Maybe I should switch from the miniwindow idea to do like Aardwolf's plugin, where they use additional "world" windows to redirect the text into.

Would that be simpler as a single function for text redirection? Omits output from the world but sends it as-is to another window?
Australia Forum Administrator #3
No. That was a mess really. That is one of the reasons I did the miniwindows. You constantly have to worry about two "world" files being open. The relevant part of the miniwindow approach is here:


for i, styles in ipairs (inv) do

  local x = 5
  for _, style in ipairs (styles) do
    x = x + WindowText (win, font, style.text, x, y, 0, 0, style.textcolour)
  end -- for
  y = y + font_height

end -- for each inventory item


That isn't too complicated. You will have more complication trying to do it the other way.
Amended on Wed 15 Sep 2010 01:05 AM by Nick Gammon
Australia Forum Administrator #4
Also see this thread:

http://www.gammon.com.au/forum/?id=10515

That describes a miniwindow you can do coloured text in, just be sending simple calls from another plugin.