Triggers & ANSI/XTERM colors

Posted by Grace on Thu 13 Dec 2012 08:14 PM — 3 posts, 15,040 views.

#0
I did search but I might have missed something, so if his is elsewhere, by all means let me know.

I am trying to set up proper spawn windows. Everything works as far as getting a triggered line to the spawn window, and getting the spawn text sent back to the main world. That's fine.

The part I can't figure out is how to do all of this with ANSI/XTERM colors intact. If I abandon the trigger itself enirely, I can try just getting the last line of output and looping like this:

while i<=n do
NoteColourRGB(spawn,GetStyleInfo(line,i,14),GetStyleInfo(line,i,15))
text=GetStyleInfo(line,i,1)
Tell(spawn,text)
i=i+1
end


This works fine, except that the only way GetStyleInfo works is off of line numbers, and with word-wrap on, one chat message can easily be two lines, sometimes more. (I'm not talking about multiple lines sent from the MU*, I'm talking about lines the client has broken up because of length.) I can't figure out any way to determine just which output lines that trigger represents, or any way to just take the trigger input and get the color information from that.

Is there something I'm missing, here? Is this just impossible? It doesn't seem like it should be this complicated.
Australia Forum Administrator #1
Triggers in Lua have a fourth argument, the style runs. That is a table. The entries are documented in the help for editing a trigger:

http://www.gammon.com.au/scripts/doc.php?dialog=IDD_EDIT_TRIGGER

(Also available inside the client).

Some examples here:

Template:faq=23
Please read the MUSHclient FAQ - point 23.


(Also see FAQ 33).
Amended on Thu 13 Dec 2012 08:39 PM by Nick Gammon
#2
Thank you! I knew there had to be something I was missing.