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 ➜ General ➜ Trigger Isolation

Trigger Isolation

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


Posted by Trunks_Zero   (13 posts)  Bio
Date Wed 27 Aug 2003 10:52 PM (UTC)
Message
Hey... Just me again :p

I was just wondering... How, in a trigger, would you set it to only isolate part of the line that needs to be matched?

For example:

People set their gossip colours to stupid things, and it gets annoying, and distracting. I want to set it so no matter who gossips in what colour, it'll turn out to be dark purple (the base gossip colour). The line would appear as follows:

Baron Billybob gossips 'haha I use stupid colours'

I currently have the trigger set to:

* gossips '*'

But, I'm not very good with triggers or anything, so it turns the entire phrase purple, even the name, when all I want is the gossip'd phrase, inside '' those.

So if anyone could help me, would be greatly appreciated.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 28 Aug 2003 06:46 AM (UTC)
Message
One approach is just to redo the colours on the line, like this (you can copy and paste this into MUSHclient) ...


<triggers>
  <trigger
   enabled="y"
   match="* gossips '*'"
   send_to="12"
   sequence="100"
 >
  <send>ColourTell "white", "black", "%1 gossips "
ColourNote "purple", "black", "'%2'"</send>
  </trigger>
</triggers>


You can rejig the colours (eg. if your background colour is not black, change "black" above to what it is).

- Nick Gammon

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

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #2 on Thu 28 Aug 2003 08:23 PM (UTC)
Message
Sorry for bothering... But I don't suppose you could give a bit of a step-by-step thing to that, could you? :/
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #3 on Thu 28 Aug 2003 10:08 PM (UTC)
Message
copy everything from <triggers> to </triggers>, go to the mushclient triggers window, and press the paste button :p

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #4 on Fri 29 Aug 2003 06:28 AM (UTC)
Message
Yea... sorry. I figured that out after ripping about 1000 hairs out of my head... *smirk*

Anyways, that doesn't quite work... it ends up something like this:

Baron Billybob gossips ' I still use stupid colours'

and then, directly after that, it returns:

Baron Billybob gossips ' I still use stupid colours'

Only with the modifyed colouring.

Baron Billybob gossips ' I still use stupid colours'
Baron Billybob gossips ' I still use stupid colours'

Like that, only two different colours. :p

And, it changes the colour of the ' things as well
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 29 Aug 2003 06:34 AM (UTC)
Message
To fix the doubling-up problem, check the "omit from output" box for the trigger.

If you don't want the quotes coloured, you'll need to replace the send text with these 3 lines:

ColourTell "white", "black", "%1 gossips '"
ColourTell "purple", "black", "%2"
ColourNote "white", "black", "'"


What that does is put the quotes into the white-on-black part.

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #6 on Fri 29 Aug 2003 08:39 PM (UTC)
Message
There is another solution. Try:
<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   keep_evaluating="y"
   regexp="y"
   match="^/w+ gossips '.*'"
   send_to="12"
   sequence="100"
   other_text_colour="purple"
   other_back_colour="black"
 >
  </trigger>
</triggers>

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   keep_evaluating="y"
   regexp="y"
   match="^/w+ gossips "
   send_to="12"
   sequence="101"
   other_text_colour="white"
   other_back_colour="black"
 >
  </trigger>
</triggers>

This should capture the full line, change it to purple, then recapture just the start of the line and change that to white. The key is the keep_evaluating and sequence settings. ;)
Top

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #7 on Fri 29 Aug 2003 11:24 PM (UTC)
Message
Omitting from output cancelled any return at all, neither the original message, nor the corrected message appeared.

And, the second suggestion, (Shadowfyr's), didn't seem to work at all... I tried tweaking it some, but couldn't get it to correct...
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #8 on Sat 30 Aug 2003 02:55 AM (UTC)
Message
You could try using .* instead of /w+. I used it because it is more specific, but it could cause a problem if the line isn't what I was thinking it should be.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #9 on Sat 30 Aug 2003 02:56 AM (UTC)
Message
OK, there is a problem in MUSHclient that if you omit from output it also omits things that you have done as part of the trigger. However, doing it in the script file works. So do this instead ...

Have this as the trigger:


<triggers>
  <trigger
   enabled="y"
   match="* gossips '*'"
   omit_from_output="y"
   script="gossip"
   sequence="100"
>
  </trigger>
</triggers>


And put this into a separate file, and make this file the script file used in the script configuration tab. Make sure you turn scripting on ...


sub gossip (name, line, wildcards)
  ColourTell "white", "black", wildcards (1) & " gossips '"
  ColourTell "purple", "black", wildcards (2)
  ColourNote "white", "black", "'"
end sub



- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


22,485 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.