| View previous topic :: View next topic |
| Author |
Message |
Landslyde Halfop
Joined: 01 May 2014 Posts: 46
|
Posted: Sun Jul 30, 2017 7:18 pm Post subject: How to check for certain nicks |
|
|
This is a simple channel statistics script that i downloaded and am trying to modify so it won't track the channel bots.
This is what I have that's failing:
| Code: | proc statistics::monitor {nickname hostname handle channel arguments} {
set nick1 "kuneho"
set nick2 "kuliglig"
set nick3 "kamel"
set nick4 "Angelica"
if {($nickname == $nick1) || ($nickname == $nick2) || ($nickname == $nick3) || ($nickname == $nick4)} { return 0 } |
I can comment out the last line and everything works (including the unwanted tracking of the bots).
How can I fix that line so that it checks for the nicks I've set and breaks out so the bots aren't tracked? |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Jul 30, 2017 8:07 pm Post subject: Re: How to check for certain nicks |
|
|
| Landslyde wrote: |
...
How can I fix that line so that it checks for the nicks I've set and breaks out so the bots aren't tracked?
|
Your code looked like it should work to me. So to be sure, I tried it.
( I changed the proc name and the value of $nick1 )
All I did was create a bind pub that I could trigger to call it.
It worked.
I could break it though, by changing my nick to include upper case letters.
I wonder if that is what you are encountering?
Next, I inserted this line:
| Code: |
set nickname [string tolower $nickname]
|
just above the if command line.
That fixed it.
If what I've tried to describe could be the problem, play around with that and see what you get.
Reference:
http://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M44
I hope this helps. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Jul 31, 2017 10:31 am Post subject: |
|
|
Why not make a bots account and add all hostmasks of the bots to that account and with a simple check if user matches that account name you skip? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Tue Aug 01, 2017 3:06 am Post subject: |
|
|
Another way much easier would be this, to ignore some nicknames.
| Code: |
set temp(ignore) [list nick1 nick2 nick3]
|
and in the proc just use
| Code: |
if {[lsearch -nocase $nickname $temp(ignore)] ne "-1"} { return }
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
Landslyde Halfop
Joined: 01 May 2014 Posts: 46
|
Posted: Thu Aug 17, 2017 8:13 am Post subject: |
|
|
Madalin:
Perfect!  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Aug 17, 2017 9:56 am Post subject: |
|
|
To make it backwards compatible instead of ne could use > (greater sign).  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Landslyde Halfop
Joined: 01 May 2014 Posts: 46
|
Posted: Tue Sep 05, 2017 4:29 pm Post subject: |
|
|
caesar:
Thanks for that input. Now I know what ne means  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Sep 06, 2017 1:10 am Post subject: |
|
|
It's easy, not equal.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|