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.

Checking nicknames

Help for those learning Tcl or writing their own scripts.
Post Reply
j
jeroen_005
Voice
Posts: 19
Joined: Sun Jun 22, 2008 7:47 am

Checking nicknames

Post by jeroen_005 »

Hi,

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

Greetings

Jeroen
F
Fill
Halfop
Posts: 80
Joined: Sun Jan 18, 2009 6:08 pm

Post by Fill »

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

proc { ... } {
if { ([string first jeroen $nick] !=-1) } { ... }
}
Here's an explanation for the "string first" command:
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
Post Reply