mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2024
Posts: 3
M
Mairel Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
M
Joined: Dec 2024
Posts: 3

on *:text:*hi*:#poseidon:{
if (!$window(@words)) window -enk1z @words
aline -hp @words $nick say $+( $1-, )
}

on *:text:*high 5*:#poseidon:{
if (!$window(@words)) window -enk1z @words
aline -hp @words $nick say: $+( $1-, )
}


This one I found works well, it tracks the words I need to check in the channel. But how can I exclude some sentences and some nicks of my choice, from this tracking? it's driving me crazy

For example, if I track the word "hi", and all the sentences that contain "hi", how can I exclude (by exclude I mean that it is not shown in the appropriate @words window) a sentence of my choice that contains that word? for example the sentence "hey, hi Mairel!" ?

Or exclude some nicks, so that if those nicks say anything with "hi" it doesn't show up in the @words window?

I'm lost and useless for codes, I would like to know if someone would be able to do it

Joined: Nov 2021
Posts: 125
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 125
you could try this:

Code

on *:text:*:#:{
  if ($istok(#poseidon,$chan,32) && $regex($1-,/^(\s*hi\s*|high\s*5)$/iS) && !$regex($nick,/^(nick|nick1|nick2|nick3|nick4)$/i) ) {  
    if (!$window(@words)) window -enk1z @words
    aline -hp @words $nick say: $+( $1-, )
  }
}


Joined: Jul 2006
Posts: 4,193
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,193
It's better to use $istok to compare nickname as well as they can contain character which would be meaningful in regex, and because there's absolutely no benefit in using regex here for nickname.
The regex used against $1- is missing an \s before 'high' but well, \s matches tab character as well as some others, which are valid in text for irc, so if you wanted to make it a word, you could use \b (matches a position, not a character), which would work better but still would match on something else than an asvii 32 space. In my experience, using just an ascii 32 space is most of the time the best option, it can be literal or \x20 can be used.

@op: to prevent a specific line you can add a condition with another && operator with ($1- != hey, hi mairel), but because this is pretty short sighted (aka you might end up with a thousand of such condition), this is were regex would actually be powerful,


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2024
Posts: 3
M
Mairel Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
M
Joined: Dec 2024
Posts: 3
Simo, Wims, thank you so much for your help and advice, I really appreciate it!

Joined: Nov 2021
Posts: 125
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 125
thanks for the corrections and suggestions Wims, i came up with this perhaps its usefull :

Code

on *:text:*:#:{
  if ($istok(#poseidon #channel1 #channel2,$chan,32) && $regex($1-,/^(\s*hi\s*|\s*high\s*5)$/iS) && !$istok(nick nick1 nick2 nick3 nick4,$nick,32)) {  
    if (!$window(@words)) window -enk1z @words
    aline -hp @words $nick say: $+( $1-, )
  }
}


Joined: Dec 2024
Posts: 3
M
Mairel Offline OP
Self-satisfied door
OP Offline
Self-satisfied door
M
Joined: Dec 2024
Posts: 3
It's definitely helpful for me, I'll definitely try it, thanks!


Link Copied to Clipboard