mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2007
Posts: 37
E
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Jun 2007
Posts: 37
Hi, well i have a swear replace code, but when i say one of the words, like 'beep' it would come out as 'beep' but when i type 'Beep' it comes out as 'beep' also, i want it to begin with a capital ketter when relevant.

Also... when i load it in everything is fine... but i can't load that code and my nick complete

because they are both 'on 1:input:#:{'

How can i run them both without everything i say repeating itself?

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Originally Posted By: Effingell
Also... when i load it in everything is fine... but i can't load that code and my nick complete

The first INPUT event is cancelling out the second if they're in the same file. Either put them in seperate files or combine the two.


Originally Posted By: Effingell
How can i run them both without everything i say repeating itself?

/help /haltdef

I don't quite understand the first problem, maybe paste your code here and give a real example to demonstrate your problem.

~ Edit ~
When halting text in the input event, the ^ prefix is not needed.

Joined: Jun 2007
Posts: 5
X
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
X
Joined: Jun 2007
Posts: 5
Try:

Code:
on *:TEXT:*:#: {
  if ($regex($1-,/(?:fuck|sex|shit|ass|dick|bitch|porn|suck|cyber|teen girls)/i)) {
    ban -u60k $chan $nick No swearing
}
else {
halt
}
}


mind you, it does pick up on Assistance and stuff like that

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm not familiar enough with regex to modify that, but it seems to me that the /s parameter indicates a space separation...now using that would mean that the 'teen girls' wouldn't be caught, but the others would and you wouldn't have to worry about something like assistance also being caught.

Additionally, the else section is useless with this.

And lastly, I've never seen the ban command use the parameters in that order, and I know that some of mIRC's commands require the parameters in a specific order. I would use
Code:
ban -ku60 $chan $nick No swearing

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
No, the '/i' at the end says case-insensitive.

To add more words, put extra 'words|pipe|words' in the long string between the pranethesis ().

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Quote:
And lastly, I've never seen the ban command use the parameters in that order, and I know that some of mIRC's commands require the parameters in a specific order. I would use
Code:
ban -ku60 $chan $nick No swearing
I assume you're talking about switch order, not parameter order. Instead of speculating though, you could simply test it and find out that ban -u60k works fine.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes, I'm aware of that, and I fail to see how the fact that the /i switch makes it case-insensitive has any bearing on my recommendation of using the /s switch to make the search reference only the space separated word. Unless you thought I was recommending using /s in place of /i, which was not my intention.

Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Off topic, but the /s modifier is actually used in conjunction with "." (matches any character in a pattern except line feeds). Using the s modifier makes the "." match any character including line feeds.

Example:
//echo -a $regex($lf,/./) - will be 0, as . by default matches anything but a line feed
//echo -a $regex($lf,/./s) - will be 1, as the /s modifier includes line feed matching with "."

I think you might have confused /s with \s. \s is a character class inside the pattern, which matches spaces and other space type character like tab, $cr, $lf and such.

Example:
//echo -a $regex($chr(32),/\s/) - will be 1, as \s matches spaces and $chr(32) is a space character
//echo -a $regex(a,/\s/) - will be 0, as "a" is not a space character

If you want to match only literal spaces, you can just enter the space character in the pattern.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
As I stated, I'm not that familiar with regex..at least I was close.


Link Copied to Clipboard