MenzAgitat wrote:Edit: I just redownloaded the script from your link and I see that you fixed the bug since yesterday.
Suggestion: Wouldn't it be better to quietly correct the case when a nickname has bad case ?
like just :
As far as I know, TestNick hasn't said anything.
instead of
As far as I know, testnick hasn't said anything. But if you meant TestNick, who by the way isn't present on #chan, then:
As far as I know, TestNick hasn't said anything.
Let me investigate and see...
<speechles> !last testnick
<bot> As far as I know, testnick hasn't said anything.
<bot> I've been watching for 13 hours, 9 minutes, 7 seconds.
<speechles> !last TestNick
<bot> As far as I know, TestNick hasn't said anything.
<bot> I've been watching for 13 hours, 9 minutes, 29 seconds.
<speechles> !last 5p33ch135
<bot> As far as I know, 5p33ch135 hasn't said anything. But if you meant speechles, then:
<bot> 18 minutes, 13 seconds ago, speechles said 'sometimes it's fun to let people bury themselves in lies. let him keep talkin' xD'.
<speechles> !last b0t
<bot> As far as I know, b0t hasn't said anything. But if you meant bot, then:
<bot> 0 seconds ago, bot said: 'speechles, give it a rest... I'm sleeping :P'.
<speechles> !last bi11y
<bot> As far as I know, bi11y hasn't said anything. But if you meant billy, then:
<bot> As far as I know, billy hasn't said anything.
<bot> I've been watching for 13 hours, 32 minutes, 1 second.
As proof the very last query shows the problem. But this is more because the recursion is occuring and during this most of the variables are destroyed, the only thing it actually remembers is a 0 or 1 for recursion. 0 it knows it hasn't recursed yet, and a 1 means it has. The only reason it even needs to track that recursion occured is when placing the "$nick is not present on $chan" line when it already has already been mentioned before the recursion occurs.
FYI, the problem with the infinite loop is shown below:
Code: Select all
# The code below is to correct leeted-up (numbers)
# within nick searches into their real letter equivalent. The problem
# is the check if the $speaker and $member are equal, this
# should NOT match. The below code is flawed and doesn't include
# this necessary check.
if {[string equal -nocase $member [string map {1 l 2 z 3 e 4 a 5 s 6 g 7 t 9 g 0 o} $speaker]] || [string equal -nocase [string map {1 l 2 z 3 e 4 a 5 s 6 g 7 t 9 g 0 o} $member] $speaker]} {
# This includes the check that $speaker and $member are NOT the
# same as well as correcting leeted-up (numbers) in nick searches
# to real letters.
if {([string equal -nocase $member [string map {1 l 2 z 3 e 4 a 5 s 6 g 7 t 9 g 0 o} $speaker]] || [string equal -nocase [string map {1 l 2 z 3 e 4 a 5 s 6 g 7 t 9 g 0 o} $member] $speaker]) && ![string equal $member $speaker]} {
The original script had 2 checks, 1st and 3rd below. Only the 1st had the check for infinite looping. The evolved version has 4 checks and all of these include the infinite-loop check:
1st = case insensitive matches in chan
2nd = case insensitive leeted-up (number) matches in chan
3rd = case insensitive matches not in chan
4th = case insensitive leeted-up (number) matches not in chan
Feel free to make any modifications/translations/releases based upon this code. The purpose of it was merely to be useful, not for profit or glory.
----
Edit: In the meantime, this shouldn't look so silly. It checks for recursion and if it still doesn't find the nickname within the spoke array will add the word "either". I'll have something better when I have more time.
- billy and the bot both share a common channel
- but it is not the same one !last was made in
<speechles> !last bi11y
<bot> As far as I know, bi11y hasn't said anything. But if you meant billy, who by the way isn't present on #test, then:
<bot> As far as I know, billy hasn't said anything either.
<bot> I've been watching for 5 minutes, 12 seconds.
The same link above will get the corrected script.