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
➜ Help with 'Gag' Trigger.
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Lemon-Aid
USA (3 posts) 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.
| Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 18 Aug 2010 06:42 AM (UTC) |
Message
| Check out:
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:
 |
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 | Top |
|
Posted by
| Lemon-Aid
USA (3 posts) 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! | Top |
|
Posted by
| Shou
USA (30 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) 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>
 |
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 | Top |
|
Posted by
| Shou
USA (30 posts) 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. | Top |
|
Posted by
| Worstje
Netherlands (899 posts) 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. | 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.
28,133 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top