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.
Help for those learning Tcl or writing their own scripts.
iamdeath
Master
Posts: 323 Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:
Post
by iamdeath » Tue Dec 25, 2007 7:06 am
Hi, I was trying to assist a user here, while working on his request I am stuck at the middle, WHO mechanism is taken from caesars script it helped me to find out how it works. but for somereasons it's not working fine ;/
Code: Select all
# binds #
bind pub - "!matchip" proc:match
bind raw - 352 who:check
proc proc:match {nick uhost handle channel text} {
global matchip
set matchip $text
putserv "WHO $channel"
}
# who check #
proc who:check {from key arg} {
global matchip
set chan [lindex $arg 1]
set nick [lindex $arg 5]
set uhost *!*@[lindex [split $arg] 3]
set realname [lrange [lindex [split $arg ":"] 1] 1 end]
if {[strlwr $matchip] == [strlwr $uhost]} {
puthelp "PRIVMSG $chan :Found $nick matching your request."
}
unset matchip
}
The error I am getting is:
Code: Select all
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:02] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
[16:03] <Cricket`-> [14:38] Tcl error [who:check]: can't read "matchip": no such variable
Thanks
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
TCL_no_TK
Owner
Posts: 509 Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire
Post
by TCL_no_TK » Tue Dec 25, 2007 12:54 pm
could try something like
Code: Select all
set match(ip) ""
proc pub:match {nick host handle channel text} {
global match
if {$text == ""} {return 0}
set match(ip) "$text"
puthelp "WHO $channel"
return 1
}
proc raw:match {from key text} {
global match
set chan [lindex $text 1]
set nick [lindex $text 5]
set host "*!*@[lindex $text 3]"
set geos [lrange [lindex [split $text ":"] 1] 1 end]
if {[strlwr $match(ip)] == [strlwr $host]} {
puthelp "PRIVMSG $chan :Found $nick matching your request."
}; set match(ip) ""; return
}
bind pub - !matchip pub:match
bind raw - 352 raw:match
putlog "loaded who.tcl"
return
btw, what ircd is this please?
iamdeath
Master
Posts: 323 Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:
Post
by iamdeath » Tue Dec 25, 2007 2:23 pm
Thanks for the reply, it's for Undernet version u2.10.12.12.
Ok the tcl works fine for the first entry but then it halts with no responce, prolly it's not killing set match(ip) properly.
Code: Select all
[23:21] <iamdeath> !matchip *!*@iamdeath.users.undernet.org
[23:21] <Cricket`-> Found iamdeath matching your request.
[23:21] <iamdeath> !matchip *!*@cricket.users.undernet.org
[23:22] <iamdeath> !matchip *!*@cricketbot.users.undernet.org
Thanks
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
TCL_no_TK
Owner
Posts: 509 Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire
Post
by TCL_no_TK » Tue Dec 25, 2007 2:44 pm
Thats gd
wasn't expecting it to work. Since i didn't test it. Thanks for the information on ircd type. use to unrealircd. Try changing
to
Also, it could be worth removing the return, since that way it would possible just return as many matches as it gets from the /who #channel output.
Like the foreach loop would. using return would brake the loop from the /who #channel
edit; fixed typeo. should of been loop not look.
Last edited by
TCL_no_TK on Wed Dec 26, 2007 2:11 am, edited 1 time in total.
iamdeath
Master
Posts: 323 Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:
Post
by iamdeath » Tue Dec 25, 2007 11:23 pm
works fine like this
So far works fine, dont know about the future
Thanks alot
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
TCL_no_TK
Owner
Posts: 509 Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire
Post
by TCL_no_TK » Wed Dec 26, 2007 2:12 am
no worries.
glad it worked out.
metroid
Owner
Posts: 771 Joined: Wed Jun 16, 2004 2:46 am
Post
by metroid » Thu Dec 27, 2007 1:07 pm
You do know that eggdrops already keep a host cached for every chanuser right?
Code: Select all
bind pub - !matchip pub:match
proc pub:match {nick host handle channel text} {
if {$text == ""} {
return;
}
foreach user [chanlist $channel] {
if {[string match -nocase [getchanhost $user] $text]} {
putserv "PRIVMSG $channel :$user matches $text."
}
}
}
iamdeath
Master
Posts: 323 Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:
Post
by iamdeath » Thu Dec 27, 2007 2:38 pm
Thanks metroid, that was really easy
.. I never thought of doing that.. thanks alot
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
TCL_no_TK
Owner
Posts: 509 Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire
Post
by TCL_no_TK » Thu Dec 27, 2007 3:51 pm
Yeah. Thats a good tip, but i dont relay on it as it only last for as long as wait-split is set for. which for me isn't verry long