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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  "Appending" text to a matching trigger
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

"Appending" text to a matching trigger

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Abedour   (1 post)  [Biography] bio
Date Tue 19 May 2009 09:29 AM (UTC)  quote  ]
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  (517 posts)  [Biography] bio
Date Reply #1 on Tue 19 May 2009 07:53 PM (UTC)  quote  ]
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.


1,965 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]