I'm trying to get the channel string to sub from
(Clan Channel Long Name): you say, "Hi."
to
(clt7): You say, "Hi."
but I'm having issues with the pattern matching bit in the gsub. I can get it to change all of the words or none of them. There's obviously something I'm overlooking, but I'm at a loss of how to actually get it to work the way I want.
I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
0
Comments
I would recommend using deleteLine() and cecho() instead of gsub, or if you're not using color, just use replace().
For example:
(haven't actually tested that, probably a typo or two in there, but it'll do what you're wanting to do)
A (slightly) more efficient way to do this would be to define the variables in a script instead of in the trigger itself.
This is all being done with gmcp in a script, no triggers at all.
I mean, sure, that's slightly more efficient, but at some point, people should try to remember that a "normal" PC these days performs billions of operations per second, and it's mathematically asinine to fine-tune efficiency on text pattern matching and string operations.
If you really cared about efficiency/overhead, you would never be using lua and/or mudlet in the first place. It's grossly inefficient, compared to what it could do, theoretically, but you'd never know it, because it's still using < 2-3% of your CPU's capability (almost all of which is due to graphics, database handling, saving logs, and network utilization).
Results of disembowel testing | Knight limb counter | GMCP AB files
GMCP documentation: https://github.com/keneanung/GMCPAdditions
svof github site: https://github.com/svof/svof and documentation at https://svof.github.io/svof