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.

Raw

Old posts that have not been replied to for several years.
Locked
r
ranny
Halfop
Posts: 49
Joined: Wed Jun 22, 2005 2:00 pm
Location: switzerland

Raw

Post by ranny »

Hello,

I've this script

Code: Select all

proc whoisscript {nick host hand chan arg} {
global bibo 
set anick [lindex $arg 0]
putserv "whois $anick"
putserv "whois $nick"
putserv "notice $nick :\0031,03#######\037whois  $anick\037#######\0031,03" 
set ::chanl $nick
foreach chana $bibo($nick) { 
set b [lindex [split $chana #] 1]
regsub -all {[#+%@&~]} $bibo($anick) "" chanl 
   if {[lsearch -exact $chanl  $b] != -1} { 
      lappend comchans #$b 
   
} 
}
putserv "notice $nick :\0031,03$comchans\0031,03"
}
But the firs time $comchans don't exist because==>can't read "bibo(liloto)": no such element in array.

But the second time the egg writes the list of the common elements(chan).

How I can make so that he writes at the first order??

Thanks
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this script is totally wrong

you need to obtain the channels some nick is on by issuing WHOIS in one proc and catching server's reply in another
r
ranny
Halfop
Posts: 49
Joined: Wed Jun 22, 2005 2:00 pm
Location: switzerland

Post by ranny »

hello,

Thanks Demond, now it's good.

Other problem, with

Code: Select all

bind pub - !reg procregister 
proc procregister {nick host hand chan arg} { 
 global identify 
 set _nick [lindex $arg 0] 
 if ![string length $_nick] { set _nick $nick } 
set identifi "no" 
putserv "whois $_nick"
 if {[info exists identify($_nick)] && $identify($_nick) == "is a registered nick"} { 
  set identifi "yes" 
 } 
 putserv "privmsg $chan :$identifi" 
}


bind raw - 307 identify    
proc identify {from key arg} { 
global identify 
set nickidentify [lindex [split $arg] 1] 
set identify($nickidentify) [lindex [split $arg :] 1] 
return 0 
}
But the first time, the egg writes always "no" ??

thanks
User avatar
CrazyCat
Revered One
Posts: 1359
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

the first time you type !reg?

logical: you set identifi to "no", identify($_nick) isn't set, so you don't match your condition to set it to yes.

You'd better try to split your procs, or have a correct algorythm.
Locked