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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Help with 'Gag' Trigger.

Help with 'Gag' Trigger.

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


Posted by Lemon-Aid   USA  (3 posts)  [Biography] bio
Date Wed 18 Aug 2010 06:35 AM (UTC)

Amended on Wed 18 Aug 2010 06:38 AM (UTC) by Lemon-Aid

Message
I need some help. I'm trying to make a Gag, that, whenever a person's name is mentioned, it just Gag's the trigger, and can keep it in a list. For example.

Quote:

Sally Keeps Yin's Ball all to Herself.

Yin Says "Hello!"

Barry Kick's Yin's face.


would all be gagged, as it contains the name 'Yin' (or match the plural 'Yin's)

I'd like to be able to add other names to this too.

This is what I currently have:

Match On: ^Yin|Yin|Yang|DreamFox*
Check: Omit From Output
Check: Ignore Case
Check: Regular Expression


This...Works.... kind of, I know it's busted, already. Mainly...I had to type 'Yin' Twice at the beginning to make it work....

as well, It will catch, and Gag words containing 'Yin', for example: 'Trying' and 'Flying', which I do not want it to. For example the sentence:

Quote:
I am Trying To Make This Gag Work


Will be Gagged and not appear.

I am new to this, and just worked with what I could find online. Help would be appreciated, as I'm stumped.



[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 18 Aug 2010 06:42 AM (UTC)
Message
Check out:

Template:post=6609 Please see the forum thread: http://gammon.com.au/forum/?id=6609.


In your case I think one problem is you don't have brackets around the alternatives, eg. do this:


Match On: (Yin|Yang|DreamFox)


Also your use of ^Yin meant it would only match on Yin at the very start of the line.

Next, to match words, but \b around it, like this:



Match On: \b(Yin|Yang|DreamFox)\b


For more details see:

Template:regexp Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Lemon-Aid   USA  (3 posts)  [Biography] bio
Date Reply #2 on Wed 18 Aug 2010 06:52 AM (UTC)

Amended on Wed 18 Aug 2010 07:09 AM (UTC) by Lemon-Aid

Message
Okay, THAT worked! Thank you!
[Go to top] top

Posted by Shou   USA  (30 posts)  [Biography] bio
Date Reply #3 on Thu 19 Aug 2010 04:52 AM (UTC)

Amended on Thu 19 Aug 2010 05:10 AM (UTC) by Nick Gammon

Message
Was going to start a new subject, but this works as well.
(i'm using VBscript if it means anything)

the line i am trying to gag is


vial61589      the toxin ether (thick)          25          4 


what i am using to gag it is:

<triggers>
  <trigger
   group="toxincheck"
   match="vial*      the toxin * (*)          *          *"
   omit_from_output="y"
   sequence="9"
  >
  </trigger>
</triggers>


it works on the line above, but not on the one below it, which is

vial168958     the toxin ether (thick)          40          131


Am i doing something wrong, or just missing something?

My computer once beat me at chess, but it was no match for me at kickboxing.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 19 Aug 2010 05:10 AM (UTC)
Message
It worked alright for me on both lines, once I enabled the trigger. You posted it disabled.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 19 Aug 2010 05:16 AM (UTC)

Amended on Thu 19 Aug 2010 05:18 AM (UTC) by Nick Gammon

Message
Ah I see the spaces better now. I would make that a regexp and not be so dependant on the exact number of spaces.

Something like this:


<triggers>
  <trigger
   enabled="y"
   group="toxincheck"
   match="^vial\d+\s+the toxin\s+.*?\s+\(.*?\)\s+\d+\s+\d+\s*$"
   omit_from_output="y"
   regexp="y"
   sequence="9"
  >
  </trigger>
</triggers>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Instead of counting spaces the symbols \s+ mean "one or more spaces", and \d+ means "one or more digits".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shou   USA  (30 posts)  [Biography] bio
Date Reply #6 on Thu 19 Aug 2010 05:18 AM (UTC)

Amended on Thu 19 Aug 2010 05:25 AM (UTC) by Shou

Message
OH ok. yeah I was looking for that code thing. Thanks a bunch for that!

But, I replaced mine with your version, and now it won't omit anything at all.

My computer once beat me at chess, but it was no match for me at kickboxing.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #7 on Thu 19 Aug 2010 04:39 PM (UTC)
Message
Try this one instead....

<triggers>
  <trigger
   enabled="y"
   group="toxincheck"
   match="^vial\d+\s+the toxin.*?\s+\d+\s+\d+\s*$"
   omit_from_output="y"
   regexp="y"
   sequence="9"
  >
  </trigger>
</triggers>


It's hard to guess what's wrong, but my guess it is an IRE mud you are playing, and I know from experience their shop listings have poor mans layouts being used, where backspaces are being used to hide stuff. Maybe they fixed it since, but by leaving out the bracketed prt in the regexp, and making it a full wildcard, it might fix your problems.

Hopefully it works better for you.
[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.


23,816 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]