Color triggers

User avatar
tincan
Posts: 13
Joined: Sun Sep 11, 2016 8:01 am

Color triggers

Post by tincan »

Hey, new to Mudlet. Just re-started playing muds after over a decade off. I own zMud and am quite familiar with how things work, but it no longer works (and unsupported with Win 10 and I'm not paying again to play text games hah). I'm trying to figure how to trigger a color on various text options.

I have found some "answers", but it's in code (I'm assuming LUA?), and I've never coded with clients. Just clicked "this is what I want triggered" and then "this is what I want the trigger to do".

So I'm sitting at the triggers page and keep getting the message when I activate that no patterns are defined. Where do I define them? I managed to type in something once (and since deleted) and it said the trigger was activated, but the color never happened. From what I see, there's the options for name (name of the trigger that you define), send plain text (guessing that is if I wanted to run a command on the trigger?), then 0-6, which is um... what is actually done on the trigger? I don't know. I'm lost. Sadly the documentation on this topic wans't helpful at all. (The keybind was fantastic though!)

Basically, I'm trying to get the words (or line) "stands up" to be highlighted in red.

Thanks in advance.
I was sane once. I got better.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Color triggers

Post by SlySven »

Those numbered lines contain the incoming things that trigger the trigger - they can be of different types but the regexp type is the one you will most likely see discussed here (IMHO) because of the fun there is in expressing what you want to respond to and not to respond to. ;) The "send plain text" box as you describe it is a "plain text response" to send straight back to the MUD server (IIRC) when it is triggered (there is no "processing" of it) OR you can write a script in the bottom area to respond to what was captured - and that is what uses the Lua language, with some Mudlet specific extra functions that interact with the application itself (see the Mudlet Lua API page of the Wiki linked to at the top right of this page).

User avatar
tincan
Posts: 13
Joined: Sun Sep 11, 2016 8:01 am

Re: Color triggers

Post by tincan »

I've put "stands up" as my supposed trigger, but still only get
Trying to activate trigger New Trigger failed; reason: No patterns defined..
when I attempt to activate it.
I was sane once. I got better.

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Color triggers

Post by chrio »

tincan wrote:I've put "stands up" as my supposed trigger, but still only get
Trying to activate trigger New Trigger failed; reason: No patterns defined..
when I attempt to activate it.
Looks like you may have specified a name but no pattern to match.
Image

for very simple triggers you can use the "send plain text" string marked as "simple action" in the above image.
For more complex things, like setting variables etc, you write the code in lua in the big textbox.

echo("You look around\n") -- show text on screen
send("look") -- send command to mud

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Color triggers

Post by SlySven »

Something put into the send plain text: "Simple action" entry is approximately equal to send("Something".."\n") in the "What to do (lua code)" area above.

User avatar
tincan
Posts: 13
Joined: Sun Sep 11, 2016 8:01 am

Re: Color triggers

Post by tincan »

Thank you all for the advice, but it was just a little check box.

I'd noticed the "type" and kept choosing color trigger, which effectively erased my pattern. I only needed to check the "highlight" box.
I was sane once. I got better.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Color triggers

Post by SlySven »

Yeah, the colour is stored as a "F##B##" code in the "PATTERN" data for a trigger that matches on the colour of the incoming text and if you change a trigger from a colour one back to a different one you may see this!

<aside>I'm not sure whether it is tracking EITHER: the colour "number" index (typically 1 to 15) for the "normal" (for some values of normal) ANSI Set Graphics Rendition code {starts with ESC and ']' and ends with 'm' OR: what we decode those colours to be. If it is the latter it will make supporting 256-colour mode MUDs interesting as there are one or two duplicates in the range of 0-255 for the colour indexes, and there is nothing stopping the user setting two colours to be the same for the current 16-colour support...</aside>

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Color triggers

Post by chrio »

tincan wrote:Thank you all for the advice, but it was just a little check box.

I'd noticed the "type" and kept choosing color trigger, which effectively erased my pattern. I only needed to check the "highlight" box.
I see, it was a misunderstanding due to the terminology in mudlet then. In mudlet, a color trigger is a trigger that reacts on the ansi-color of the text the mud sends to you.

User avatar
tincan
Posts: 13
Joined: Sun Sep 11, 2016 8:01 am

Re: Color triggers

Post by tincan »

Hmm, I keep to a pretty basic mud; no triggers/stacks in most cases, and not many colors unless you manually define them (and many in-game aren't definable, which is why I'm here). I didn't even know that this would be a possibility, but that's definitely good info. Thanks!


Edit: On this topic still, how would I enable the color to apply to the entire line that the pattern is found in?
I was sane once. I got better.

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Color triggers

Post by chrio »

tincan wrote:Edit: On this topic still, how would I enable the color to apply to the entire line that the pattern is found in?
The two easiest ways to do this that I can think of are:

1) Extend the pattern to include the whole line and use the highlight tickbox.
As a perl regex pattern:

Code: Select all

.*stands up.*
This would include the whole line if it contains "stands up".

2) Using lua. Works with most trigger types.
Code: [show] | [select all] lua
selectCurrentLine()    -- selects the line
setFgColor( 255,0,0 )  -- change the color (red,green,blue values)
Last edited by chrio on Sat Sep 17, 2016 9:48 am, edited 1 time in total.

Post Reply