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.

need help with split the realname

Help for those learning Tcl or writing their own scripts.
Post Reply
s
skywalker
Voice
Posts: 5
Joined: Sat Jan 07, 2012 7:46 pm

need help with split the realname

Post by skywalker »

i use my realname field to fill in the a/s/l
now i want to strip that into 3 seperate things.
and be displayed like belowe
i need help with the what to write here sections in the script

Code: Select all

bind join - *  whoisjoin
bind raw * 311 realname

# nicks to be exempted from asl
set aslexclude_nicks ""

proc whoisjoin {nick uhost hand chan} {
   global aslexclude_nicks botnick
   if {$nick==$botnick} { return }
   if {[string match "*$nick;*" $aslexclude_nicks]} { return }
   set ::jchan $chan
     putquick "whois $nick"
}

proc realname {from key arg} {
global botnick nick
   set argst [clone_stripcodes [string trim $arg]]
   putlog "arg is $arg"
   set cchan $::jchan
   set realname [string range $argst [expr [string first : $argst] +1] end]
   set age WHAT TO WRITE HERE
   set sex WHAT TO WRITE HERE
   set location WHAT TO WRITE HERE
   putlog "$nick is a $age years old $sex from $location"
}
User avatar
CrazyCat
Revered One
Posts: 1242
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Just split your realname on the "/" character, you'll have an usable list.

Code: Select all

proc realname {from key arg} {
global botnick nick
   set argst [clone_stripcodes [string trim $arg]]
   putlog "arg is $arg"
   set cchan $::jchan
   set realname [split [string range $argst [expr [string first : $argst] +1] end] "/"]
   set age [lindex $realname 0]
   set sex [lindex $realname 1]
   set location [join [lrange $realname 2 end]]
   putlog "$nick is a $age years old $sex from $location"
}
s
skywalker
Voice
Posts: 5
Joined: Sat Jan 07, 2012 7:46 pm

Post by skywalker »

thx mate
Post Reply