This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
Bytez
Op
Posts: 168 Joined: Mon Aug 11, 2003 1:42 pm
Post
by Bytez » Sun Oct 12, 2003 4:32 pm
Hi, I want my bot to ban people who type 4 or more consecutive ???? or !!!! after a sentence, or just by itself. How can I do this?
Code: Select all
bind pubm - *!!!!* kickass
proc kickass { nick host hand chan text } {
if {[matchattr $hand o|o $chan]} return
putserv "KICK $chan $nick :kicked for using 4 consecutive !!!!"
}
This didn't work, it kicked when people used 2 consecutive ?? and when they type
and
Thanks!
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Mon Oct 13, 2003 8:24 am
could you rephrase your question ?
XplaiN but think of me as stupid
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Oct 13, 2003 9:06 am
I think the bind should be:
bind pubm - *\!\!\!\!* kickass
Ofloo
Owner
Posts: 953 Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:
Post
by Ofloo » Mon Oct 13, 2003 9:09 am
and what would that do ?
XplaiN but think of me as stupid
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Oct 13, 2003 9:16 am
well my bad, I thought ! is a wildcard like ? * % ~ . but no
then try:
Code: Select all
bind pubm - * kickass
proc kickass {nick uhost hand chan arg} {
if {[string match [split $arg] "*!!!!*"] || [string match [split $arg] "*\?\?\?\?*"]} {
putserv "KICK $chan $nick :kicked for using 4 consecutive !!!!/????"
}
}
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Oct 13, 2003 12:08 pm
The [string match [split $arg] "*\?\?\?\?*"] should actualy be [string match "*\?\?\?\?*" [split $arg]] because is a match of a string against something, not something against a string like you did. Anyway, is not good. Demonstration:
Code: Select all
bind pubm - * my:bla
proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\?\?\?\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
(07:05) (caesar) ????
(07:05) (@bot) match!
(07:05) (caesar) ?aaaaa
(07:05) (@bot) match!
and with
Code: Select all
bind pubm - * my:bla
proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\\\?\\\?\\\?\\\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
do you notice any difference?
(07:07) (caesar) ?aaaaa
(07:07) (caesar) ????
(07:07) (@bot) match!
Once the game is over, the king and the pawn go back in the same box.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Oct 13, 2003 4:45 pm
using \\ would work right I guess too?
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Mon Oct 13, 2003 9:19 pm
caesar wrote: and with
Code: Select all
bind pubm - * my:bla
proc my:bla {nick uhost hand chan text} {
if {[string match -nocase "*\\\?\\\?\\\?\\\?*" [split $text]]} {
putserv "PRIVMSG $chan :match!"
}
}
ok... first off....
string match (as the name suggests) performs an operation on a
string .
the variable
text is a
string .
split converts a
string into a
list .
Thus... we nix the split altogether, as 'string match' is a string function, not a list function. which gives us...
Code: Select all
if {[string match -nocase "*\\\?\\\?\\\?\\\?*" $text]} {
Secondly, you can save on keystrokes by using {}'s instead of "'s and removing some of the back slashes:
Code: Select all
if {[string match -nocase {*\?\?\?\?*} $text]} {
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Tue Oct 14, 2003 2:31 am
Duno whty I've added the split there..
Your sugestion is good also..
Once the game is over, the king and the pawn go back in the same box.