|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Wed Dec 10, 2014 10:10 am
Need a better way to gag, any suggestions? |
So, I have about 1,000+ gag triggers, and I think it's getting to be too much. I'm interested to know if there's a better solution?
I was trying to figure out a way to make a trigger for (*) (so basically everything) and using a list, so if (%1) is in list @stuffToGag, #gag..
A) is this a smarter way to do it, 1 trigger instead of 1,000 triggers
B) how do I even do such a thing.
Assistance please.. Thanks a lot!
I should add... I've kind of figured out a way to do it using %ismember .. #if (%ismember(%1,@myList)) {#gag} {} ... However, in the list, I can't seem to use triggers... so like (%W) smacks rat. I'd have to make individual triggers for every name I want to gag.. This is one of the challenges I'm having..
Thanks. |
|
|
|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Fri Dec 12, 2014 3:14 pm Re: Need a better way to gag, any suggestions? |
Having a trigger that fires on every line will be a bad idea in general. For a simple trigger action (like assigning a value to a variable) the disadvantage may be unnoticeable, but running %ismember for a longer list will be very slowing down.
There however other possibilities to merge your triggers into one by adjusting the pattern. Give us some examples and we'll figure it out together. |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Fri Dec 12, 2014 8:33 pm |
The problem is, I have close to 1,000 triggers to gag all the unnecessary output from the mud. They're very heavy on background noise, mobs talking, rooms being "alive" etc.. So it's not anything repetitive, so I don't think I can give any example.
|
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Fri Dec 12, 2014 10:19 pm |
So far, I'd like to say that my trigger is actually improving my client speed.. It's triggered on ^(*)$ so it doesn't search everything, only full lines. I went from about 1,000 triggers to about 601 (still can't find a way to trigger using matches like %w and %d) .. But it's good so far..
That being said, I'm sure there's still a better why to do it and I'm open to suggestions.. especially ones allowing matching :)
Thanks again. |
|
|
|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Sat Dec 13, 2014 2:31 pm |
Then maybe =~ operator will be interesting for you. For example
"hasty green goblin" =~ "hasty %w goblin"
will return true. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Dec 15, 2014 2:48 pm |
Obviously your list of gagstuff is too large to really do much with, but what about stuff you don't want gagged? If it's not too large (obviously it's going to be way less than what you're gagging), perhaps you could get away with a #SWITCH with the else condition being your gag and everything before it just having an empty code block:
#switch (%1)
(%match(%1,"pattern")) {}
(%match(%1,"pattern")) {}
...
(1) {#gagspace}
Could perhaps even try to group similarly-formatted lines together instead of specifically handling each one... |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Thu Dec 18, 2014 12:34 pm |
Your best bet would be to make a DB variable, to house all your one off patterns.
#TR {{@stuffToGag}} {#GAG}
And to consolidate all the patterns with only minor variation into one.
#TR {You gather (%d) coins made of (%w).} {#GAG;share %1 %2 coins} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|