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 

need help with split the realname

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


Joined: 07 Jan 2012
Posts: 5

PostPosted: Sun Jan 08, 2012 4:03 pm    Post subject: need help with split the realname Reply with quote

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:

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"
}
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Jan 09, 2012 8:53 am    Post subject: Reply with quote

Just split your realname on the "/" character, you'll have an usable list.
Code:
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"
}

_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
skywalker
Voice


Joined: 07 Jan 2012
Posts: 5

PostPosted: Mon Jan 09, 2012 1:08 pm    Post subject: Reply with quote

thx mate
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