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.

NICK/CHAN INFO script (SOLVED)

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
masheen
Voice
Posts: 28
Joined: Sat Apr 28, 2007 1:14 pm

Post by masheen »

thanks to the bot of you... i believe the !chaninfo and !nickinfo is ok now... the problem now is the !who <nick> the one u made iamdeath seems to be working, but comes with a little bug dat i simply could not see in ur code... the problem is that when i restart the bot with the new !whois script... it starts displaying all the whois infor of all the nicks from the channel even when no one including me initiated a !whois command yet. dya guys think its being triggered by another script badchan.tcl maybe? i duno... pls help ^_^ again thanks to the both of u.
let he who is without stone cast the first sin
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Actually, the code written by iamdeath will dump the information from any WHOIS to the channel specified - including the ones done by the eggdrop core itself.. You'd probably need some request-tracking, so that output is only produced when a whois is requested using this script. The queueing system in my previous post might be a something to get started with.

Also, it does not use "args" properly within the script:whois1, as this is already a list of arguments. Changing the name to something different than "args" should solve that problem however.
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks for point it out masheen, to me the bot is showing on it's whois when it's reconnecting or being restarted. It is not showing all the users in the channel. I guess the tcl badchan.tcl you're using is causing the problem, that tcl must be scanning hosts for all the users in the channel. Try to stop it and then restart the bot you will find out yourself, yet I am reading more about it and if I get something helpfull i'll revise my script.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Code: Select all

set mychannel "#channel"
bind pub -|- !whois script:whois

proc script:whois { nick host handle chan text } {
global user
set text [split $text]
set user [lindex $text 0]
if {$user == ""} {puthelp "NOTICE $nick :You need to supply a nickname."; return}
putquick "WHOIS $user"
}

bind raw - "311" script:whois1
bind raw - "312" script:whois1
bind raw - "318" script:whois1
bind raw - "319" script:whois1
bind raw - "401" script:whois1

proc script:whois1 {from key args} {
global mychannel user
set text [split $args]
set nickname [lindex $text 1]
if {[string tolower $nickname] != [string tolower $user]}  {return 0}
set topaste [lrange $text 1 end]
regsub -all {\{} $topaste "" topaste
regsub -all {\}} $topaste "" topaste
regsub -all {\\} $topaste "" topaste
putserv "PRIVMSG $mychannel :$topaste"
}


putlog "!whois script loaded by iamdeath."
Now it should not occur the problem, I just tested it and yeah ignore this msg in DCC.

Code: Select all

Tcl error [script:whois1]: can't read "user": no such variable
Tcl error [script:whois1]: can't read "user": no such variable
Tcl error [script:whois1]: can't read "user": no such variable
Tcl error [script:whois1]: can't read "user": no such variable
This will come when you restart the bot, once you perform the !whois command that msg will stop coming. Hey excuse me please, I aint a good TCL programmer, I am in learning stage.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@iamdeath:
Try adding some tests wether user has been set before you actually read it (in script:whois1), and you'll get rid of those errors.

Also, change the name of the argument "args" to something else (anything but "args"), also "join" the output from "lrange", and you can drop all those regsubs (alot faster, and proper).
ie:

Code: Select all

proc script:whois1 {from key text} {
...
set text [split $text " "]
...
set topaste [join [lrange $text 1 end] " "]
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

thanks alot nml.. the 2nd tip I am using and I got rid of regsub issues thanks alot for the tip.. but the first tip.. I can't get it done, can you help me how to solve that issue?.. I've tried all the possible ways.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Try something like this:

Code: Select all

if {![info exists user] || [string compare -nocase $nickname $user]} {
The trick is that tcl uses "lazy" operators, that is, in the case of "test1 || test2", if the first test is true, there is no need to evaluate the second one, since it cannot alter the resulting condition. So in the above case, if the variable does'nt exist, there is'nt any use for testing it against "nickname".
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Code: Select all

set mychannel "#Channel"
bind pub -|- !whois script:whois

proc script:whois { nick host handle chan text } {
global user
set text [split $text]
set user [lindex $text 0]
if {$user == ""} {puthelp "NOTICE $nick :You need to supply a nickname."; return}
putquick "WHOIS $user"
}

bind raw - "311" script:whois1
bind raw - "312" script:whois1
bind raw - "318" script:whois1
bind raw - "319" script:whois1
bind raw - "401" script:whois1
bind raw - "301" script:whois1
bind raw - "313" script:whois1
bind raw - "330" script:whois1
bind raw - "317" script:whois1

proc script:whois1 {from key text} {
global mychannel user
set text [split $text " "]
set topaste [join [lrange $text 1 end] " "]
set nickname [lindex $text 1]
if {![info exists user] || [string compare -nocase $nickname $user]} {return 0}
putserv "PRIVMSG $mychannel :$topaste"
}


putlog "!whois script loaded by iamdeath."
yay! Thanks alot nml, that was really very usefull.. Thanks alot, I understand it now, earlier it was'nt clear to me. Now it's in my brain like drilled :D.. you rock man... by the way, did we just wasted our time, we already had a tcl like this in TCL archive LOL
WHOIS TCL
anyway got to learn many things from this posts and yeah I have updated more raw so that all the replies can be seen in the channel.

enjoy masheen and many thanks to nml
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
masheen
Voice
Posts: 28
Joined: Sat Apr 28, 2007 1:14 pm

Post by masheen »

thanks for the fast replies and for the help. :) i learn a lot on this one ^_^ m closing the topic.
let he who is without stone cast the first sin
K
KEMA
Voice
Posts: 8
Joined: Mon Nov 20, 2006 10:29 am
Location: indonesia

how to to make it works to all channel that bot entry?

Post by KEMA »

how to make it work automatically to all channel that bot entry?
example :
we are stay in #chan-b
than command in #chan-b !chaninfo #chan-a
the bot will display information at #chan-b about #chan-a
I need additional info for how many users there, how many banned mask, how many ops, and how many +v are in chan-a.

:? thx
Post Reply