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 

Checking nicknames

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


Joined: 22 Jun 2008
Posts: 19

PostPosted: Thu Feb 12, 2009 12:39 pm    Post subject: Checking nicknames Reply with quote

Hi,

How can i check if a username contains some letters Very Happy Something like the nick contains "Jeroen" Very Happy

Greetings

Jeroen
Back to top
View user's profile Send private message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Thu Feb 12, 2009 1:24 pm    Post subject: Reply with quote

Hi jeroen_005

You can use strings to do that. If you want to see if a certain nick IamJeroen has "Jeroen", just use this:

Code:

proc { ... } {
if { ([string first jeroen $nick] !=-1) } { ... }
}


Here's an explanation for the "string first" command:

Quote:

string first string1 string2
Search string2 for a sequence of characters that exactly match the
characters in string1. If found, return the index of the first character
in the first such match within string2. If not found, return -1.

(Taken from: http://johoho.eggheads.org/eggdrop/other/guide2tcl.html)


Which means that, in this case, if the return is different from -1, *jeroen* is in the specified nickname. You don't want the index of the first character tha tmatch the other string, so you just have to say the bot that when this is different from -1, make the procedure you'll write.

Understood that?

See ya,
Fill
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