mIRC Homepage
Posted By: Quinch Conditional hiding of PMs from other users? - 14/01/12 07:30 AM
A possibly tricky question - is there a way to set up a script to not show a private message from users if it contains a certain string?
Code:
on ^*:text:*text*:?:{ haltdef }
Well, that was much simpler than expected. As a followup question - if you're an op in a channel, is it possible to filter it out for everyone?

{this might be veering away from scripting itself, but beats making a separate topic}
Code:
on @^*:text:*:?:{ haltdef }
Hmm, that doesn't seem to work, but it's actually a moot point now. Another question, though - is it possible to haltdef while still executing other triggers? For example -

on ^*:text:!*:?:{ haltdef }
on ^*:text:*:?:/respond

- hides the message when I PM myself with "!test", but also doesn't return the echo. Is there a way to ignore the message, but also have other events based on that message fire as well?
Oh yeah, it wouldn't work would it? Private messages don't have ops :p

Anyway, I think you need to define more narrowly what you're trying to accomplish. The code you've provided is functional assuming that /respond exists - but maybe it isn't behaving how you expect it to. What do you mean by "doesn't return the echo"?

With the code you've provided !test will trigger the first event, not the second (because it has already triggered on the first and both share ^). Anything not beginning with ! will trigger the second.

Code:
on ^*:text:!*:?:haltdef
on *:text:!test:?:echo -ag $nick said !test
on *:text:!com:?:echo -ag $nick said !com
on *:text:!*:?:echo -ag $nick said any other command


Here all !commands are hidden but can still be processed when the other events fire.
Ahh, okay. What's the ^ signify, then?
^ is used specifically to be able to halt text. You can look up its description under /haltdef

^ and non-^ are treated separately so events of both types can be fired by the same trigger.

Only the first event (of a given type) which matches the text is fired if multiple events are defined in the script.
^ triggers before mIRC listens to the standard, default text, which allows you to halt it and apply your own custom settings.
© mIRC Discussion Forums