|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Mon Dec 19, 2022 12:11 am
Out of my depth, need help with a script. |
I am using cmud to have multiple connections to the same server, and i use the chat capture features to have chats all go to a side window. All good so far. The crux of the issue is that most often the messages come across globally and thus each of my characters see it at the same time leaving me with MANY copies of the same exact message. I would like to correct that and have the comms window only show me unique messages. Seems simple enough until you factor in chat that gets captured by me as well. Here are some basic examples of how I wish to determine what is a copy or not to make it so that anything past the first is just suppressed.
Examples:
You <channel> '<message>'
<Person> <channel>s '<message>'
and:
[INFO]: <message>.
Please note that all infos end in a period like "[INFO]: James is cool. ", and all channels lack an ending S for my own messages, but DO include an S for messages from all others, like "You gametalk 'James is cool' " vs "Jim gametalks 'James is cool' " (all trailing spaces before end-quotes are placed to make it easier to see how the messages are formatted. In game they aren't surrounded by quotation marks, I just did that here because for some reason it felt appropriate to do when listing examples.)
I'm decent at scripting so if you feel like it isn't as bad of a scripting job as I think, you may choose to instead just give me huge hints toward coming up with the solution myself. Or if it's easier to just code it out and post it, that's fine too. At this point, I'm not picky and will take any and all help I can get to prevent comms window spam of doom.
Thanks in advance,
Schoktra BloodThirst |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: Mon Dec 19, 2022 2:35 pm |
Personally I would set a variable [ Blacklist = Multi_name_1|Multi_name_2|etc|etc ] specifically for the chars you want captured but not sent to the chat window. This will allow your capture trigger to fire off but only send based on who isn't on your @blacklist (alt chars)
#IF (<person> != %ismember(Blacklist)) {capture & send}
**not able to access cmud atm so can't double check syntax but gist of code is there... |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Dec 19, 2022 3:05 pm |
Assuming you have a basic trigger working already, the if statement would be:
#IF (!%ismember($name, @blacklist)) {#CAP Comms}
I tend to prefer to sort things out via scoping. Make it so the other characters don't have access to the trigger in the first place and you don't have to error check where the info is coming from.
Ideally, each character has its own session package and any shared scripts would be in an additional package.
Then if you only want Bob to capture to comms, that trigger is only in bob's package, instead of the shared package. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Tue Dec 20, 2022 4:07 am |
The thing is, I never know who's getting what messages as each character can receive private messages and messages from the room they are in, which if they aren't in the same room, won't be shared. I just want to basically have the comms window check the current incoming message contents against the previous message contents which came before it, and if they match suppress the new message regardless of who the message is from. cuz like something global all my characters will see the 100% exact same thing "<otherperson> <channel>s '<message>' " but for messages I send globally my sending character will see "You <channel> '<message>' " but my other characters will see it the <otherperson> way.
The general gist is that I like using one comms window for all comms, but i don't want it to be spammed with the same message 2 - 12 times depending on how many charas i'm running with at that time.
[Edit]
So, I'm now figuring that in the comm window package I'd make regex triggers for:
[INFO]: <message>.
You <channel> '<message>'
<name> <channel>s '<message>'
then check if <message> matches @prev_message, and suppress? |
|
Last edited by schoktra on Tue Dec 20, 2022 4:15 am; edited 1 time in total |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Tue Dec 20, 2022 4:14 am |
Well, there is a very simple method to do this...
#TR {*} {#IF (%line=%line2) {#GAG}}
Move this trigger into your comms window.
You might get a duplicate if one of your characters is sending the message, but that should be it. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Tue Dec 20, 2022 4:17 am |
shalimar wrote: |
Well, there is a very simple method to do this...
#TR {*} {#IF (%line=%line2) {#GAG}}
Move this trigger into your comms window.
You might get a duplicate if one of your characters is sending the message, but that should be it. |
That's actually a really simple and elegant solution and if I only get one single duplicate on messages I sent, that's probably not the end of the world. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Tue Dec 20, 2022 4:28 am |
You could even get more complicated with it
#CALL %match(%line, "%w (%w){s|} (*)", $name1, $channel1, $message1)
#CALL %match(%line2, "%w (%w){s|} (*)", $name2, $channel2, $message2)
#IF (($channel1=$channel2) AND ($message1=$message2)) {#IF ($name1="You") {#GAG} {#GAG -1}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Tue Dec 20, 2022 4:34 am |
Okay, idk if %line and %line2 woulda worked, but based on %line(num) which i found in the documentation after Shalimar's message, here's what I came up with, and it seems to be doing the trick:
Quote: |
#TR {*} {#IF (%line(0)=%line(1)) {#GAG}}
|
|
|
|
|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Tue Dec 20, 2022 4:38 am |
shalimar wrote: |
You could even get more complicated with it
#CALL %match(%line, "%w (%w){s|} (*)", $name1, $channel1, $message1)
#CALL %match(%line2, "%w (%w){s|} (*)", $name2, $channel2, $message2)
#IF (($channel1=$channel2) AND ($message1=$message2)) {#IF ($name1="You") {#GAG} {#GAG -1}} |
Okay, your previous thing that was simple works, but I think I'm still gonna try this, cuz from cursory glance this looks like it'll be a much more robust solution giving me what i was looking for in the first place, and if not exactly what i wanted, at least much closer.
[Edit]
I wasn't able to get this one to work. It compiled and triggered just fine, but it didn't gag the message, and didn't even populate any variables. Do I have to manually add the variables first, or should this trigger create them automatically as most of my other triggers have done? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Tue Dec 20, 2022 11:13 am |
It was untested, and the variables are all local, so they only exist during runtime
you could use #SAY in the trigger for the sake of error testing data and remove it once it works
#HELP %match says it implicitly declares them for you, but throwing a #LOCAL might help
it's also possible that my pattern doesn't actually match |
|
_________________ Discord: Shalimarwildcat |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Tue Dec 20, 2022 11:26 am |
Oh... thats silly, i only captured two variables in my patterns instead of three, no wonder it doesn't work
Try this:
#CALL %match(%line, "(%w) (%w){s|} (*)", $name1, $channel1, $message1)
#CALL %match(%line2, "(%w) (%w){s|} (*)", $name2, $channel2, $message2)
#IF (($channel1=$channel2) AND ($message1=$message2)) {#IF ($name1="You") {#GAG} {#GAG -1}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
schoktra Newbie
Joined: 11 Jan 2021 Posts: 8
|
Posted: Tue Dec 27, 2022 12:40 am |
Sorry for no response sooner. I got laid out with the 'rona. The status of this was that this was headed the direction I wanted to go, but I stopped using the chat capture on multiple characters at the same time cuz there's some sort of bug in cmud where multiple characters using the same comms window makes it jump around which character you have selected. As in lets say I have 3 characters open, a chat message comes in that they all 3 see. whoever sees it LAST is what screen it suddenly jumps me to. So say the order the charas saw the message was 3, 1, 2 well then even if i was actively typing/moving on character 1, suddenly i'm controlling character 2. I completely disabled and even removed the trigger to see if that was the cause, but it is not. As long as they're sharing a comm window this happens regardless of whether or not there are any triggers attached to it.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Wed Dec 28, 2022 8:55 pm |
In that case, I would suggest each character be run in a separate instance of CMUD.
Then they each have their own comms window and it should no longer switch focus on you mid sentence. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|