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 

WHO help

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


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Tue Dec 25, 2007 7:06 am    Post subject: WHO help Reply with quote

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:
# 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:
[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*...
Back to top
View user's profile Send private message Visit poster's website
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Dec 25, 2007 12:54 pm    Post subject: Reply with quote

could try something like
Code:
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?
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Tue Dec 25, 2007 2:23 pm    Post subject: Reply with quote

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:
[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*...
Back to top
View user's profile Send private message Visit poster's website
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Tue Dec 25, 2007 2:44 pm    Post subject: Reply with quote

Thats gd Embarassed wasn't expecting it to work. Since i didn't test it. Thanks for the information on ircd type. use to unrealircd. Try changing
Code:
     }; set match(ip) ""; return
to
Code:
     }; return
Smile 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.
Code:
     };
Like the foreach loop would. using return would brake the loop from the /who #channel

edit; fixed typeo. should of been loop not look.
_________________
TCL the misunderstood


Last edited by TCL_no_TK on Wed Dec 26, 2007 2:11 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Tue Dec 25, 2007 11:23 pm    Post subject: Reply with quote

works fine like this Very Happy

Code:
 }; return


So far works fine, dont know about the future Razz

Thanks alot Wink
iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Wed Dec 26, 2007 2:12 am    Post subject: Reply with quote

no worries. Very Happy glad it worked out.
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Thu Dec 27, 2007 1:07 pm    Post subject: Reply with quote

You do know that eggdrops already keep a host cached for every chanuser right? Rolling Eyes

Code:
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."
        }
    }
       
}
Back to top
View user's profile Send private message
iamdeath
Master


Joined: 11 Feb 2005
Posts: 323
Location: *HeLL*

PostPosted: Thu Dec 27, 2007 2:38 pm    Post subject: Reply with quote

Thanks metroid, that was really easy Razz.. I never thought of doing that.. thanks alot Smile

iamdeath
_________________
|AmDeAtH @ Undernet


Death is only the *Beginning*...
Back to top
View user's profile Send private message Visit poster's website
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Thu Dec 27, 2007 3:51 pm    Post subject: Reply with quote

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 Confused
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
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