Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Triggers & ANSI/XTERM colors

Triggers & ANSI/XTERM colors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Grace   (2 posts)  Bio
Date Thu 13 Dec 2012 08:14 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 13 Dec 2012 08:38 PM (UTC)

Amended on Thu 13 Dec 2012 08:39 PM (UTC) by Nick Gammon

Message
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).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Grace   (2 posts)  Bio
Date Reply #2 on Thu 13 Dec 2012 09:20 PM (UTC)
Message
Thank you! I knew there had to be something I was missing.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,070 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.