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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun May 05, 2019 2:45 pm
could this msl code be translated into tcl
Code: Select all
if ($regex($nick,/(.)\1+/g) > 3) { kick $chan $nick counts $regex($nick,/(.)\1+/g) duplicate characters }
it matches any duplicate char of any kind and counts as one and adds a total and if exceeded 3 matching duplicates it executes kick
Join : aabbccddeeff ~
Mibbit@Amigo.Premium.net
aabbccddeeff Kicked from #tcl-test By +simo <> ( counts 6 duplicate characters )
possibly for nick change as well
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sun May 05, 2019 3:46 pm
Code: Select all
if {[set dup [regexp -all {(.)\1} $nick]] >= 3} { putkick $chan $nick "counts $dup duplicate characters" }
Last edited by
heartbroken on Sun May 05, 2019 5:53 pm, edited 2 times in total.
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun May 05, 2019 5:44 pm
thnx for the response heartbroken
i tried this:
Code: Select all
bind join - * join:nickcheck
bind nick - * nick:nickcheck
proc nick:nickcheck {nick uhost hand chan newnick} {
join:nickcheck $newnick $uhost $hand $chan
}
proc join:nickcheck {nick uhost hand chan} {
global botnick
if {[string tolower $nick] != [string tolower $botnick]} {
if {[botisop $chan]} {
if {[set dup [regexp -all {(.)\1} $nick]] >= 3} {
putkick $chan $nick "counts $dup duplicate characters"
}
}
}
}
and with a nick like hhhgggfffdddd it should detect 4 duplicate chars but instead it says it detected 5 not sure why ?
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun May 05, 2019 5:51 pm
i think i see why it counts repeated chars twice or more like gggg it counts as 2 while its repeats from 1 char and should count as 1
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sun May 05, 2019 6:00 pm
(.) -> matches any char, with \1 matches 2 same characters. if you want to match 3 same chars -> (.)\1\1 …
and regexp's -all option, gives how many matches in given string. >= checking if counted matches equal or bigger than 3 … do the job...
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun May 05, 2019 6:21 pm
tnx for the clarfication
also could it be done that repeat chars more than one of a char counts as 1 so hhhhhhhhh counts as 1 and gg counts as 1 and ggg counts as 1 and so on
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Mon May 06, 2019 10:38 am
for example:
gghhhhkkkkkwwwwww will have total count of 4
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Mon May 06, 2019 4:48 pm
(.)\1+ will do what you want .
it matches two and more same chars in string.
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1081 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Mon May 06, 2019 6:12 pm
excellent thanx heartbroken