egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to check for certain nicks

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 43

PostPosted: Sun Jul 30, 2017 7:18 pm    Post subject: How to check for certain nicks Reply with quote

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
View user's profile Send private message
willyw
Owner


Joined: 15 Jan 2009
Posts: 921

PostPosted: Sun Jul 30, 2017 8:07 pm    Post subject: Re: How to check for certain nicks Reply with quote

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
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3401
Location: Area 51

PostPosted: Mon Jul 31, 2017 10:31 am    Post subject: Reply with quote

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?
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 300
Location: Constanta, Romania

PostPosted: Tue Aug 01, 2017 3:06 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Landslyde
Halfop


Joined: 01 May 2014
Posts: 43

PostPosted: Thu Aug 17, 2017 8:13 am    Post subject: Reply with quote

Madalin:

Perfect! Very Happy
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3401
Location: Area 51

PostPosted: Thu Aug 17, 2017 9:56 am    Post subject: Reply with quote

To make it backwards compatible instead of ne could use > (greater sign). Smile
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
Landslyde
Halfop


Joined: 01 May 2014
Posts: 43

PostPosted: Tue Sep 05, 2017 4:29 pm    Post subject: Reply with quote

caesar:

Thanks for that input. Now I know what ne means Smile
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3401
Location: Area 51

PostPosted: Wed Sep 06, 2017 1:10 am    Post subject: Reply with quote

It's easy, not equal. Smile
_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber