[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  "Appending" text to a matching trigger

"Appending" text to a matching trigger

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


Posted by Abedour   (1 post)  [Biography] bio
Date Tue 19 May 2009 09:29 AM (UTC)
Message
Is there perhaps a way to append certain text to the end of a line of a certain trigger that's been called in a line of text?

I know something similar like:

<trigger
custom_colour="1"
enabled="y"
match="*DISMEMBERS*"
omit_from_output="y"
send_to="2"
sequence="100"
>
<send>%1DISMEMBERS%2 [65]</send>
</trigger>

Would replace and then append [65] at the end of the line, but of course, it would change the color and all that jazz. Is there any other way to do it to simply append something at the end of the line in a different color, while leaving everything on the line exactly the same?

Thanks in advance.
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #1 on Tue 19 May 2009 07:53 PM (UTC)
Message

<trigger
custom_colour="1"
enabled="y"
match="*DISMEMBERS*"
omit_from_output="y"
send_to="14"
sequence="100"
>
<send>
for k,v in ipairs(TriggerStyleRuns) do
 ColourTell(RGBtoColourName(v.textcolour), RGBtoColourName(v.backcolour), v.text)
end
ColourNote("limegreen", "black", " [65]")

</send>
</trigger>


This depends on your scripting language being set to Lua.

send_to 14 is "Script (after omit)". MushClient creates a table that Lua can use with all the styles (color codings) named TriggerStyleRuns.

If you're not using Lua... Change! oh, wait...
It's still possible, although the TriggerStyleRuns table isn't available to loop through. You'd have to script a combination of GetLineInfo and GetStyleInfo to loop thru the line. In which case, it'd probably just be easier to make these a plugin that uses Lua.
[Go to top] 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,861 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]