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.

How to check for certain nicks

Help for those learning Tcl or writing their own scripts.
Post Reply
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

How to check for certain nicks

Post by Landslyde »

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: Select all

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?
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: How to check for certain nicks

Post by willyw »

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: Select all

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 !
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Another way much easier would be this, to ignore some nicknames.

Code: Select all

set temp(ignore) [list nick1 nick2 nick3]
and in the proc just use

Code: Select all

if {[lsearch -nocase $nickname $temp(ignore)] ne "-1"} { return }
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

Post by Landslyde »

Madalin:

Perfect! :D
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
L
Landslyde
Halfop
Posts: 46
Joined: Thu May 01, 2014 6:01 pm

Post by Landslyde »

caesar:

Thanks for that input. Now I know what ne means :-)
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

It's easy, not equal. :)
Once the game is over, the king and the pawn go back in the same box.
Post Reply