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 

NICK/CHAN INFO script (SOLVED)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Mon Apr 30, 2007 1:59 pm    Post subject: Reply with quote

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


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 2:07 pm    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


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

PostPosted: Mon Apr 30, 2007 2:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
iamdeath
Master


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

PostPosted: Mon Apr 30, 2007 3:21 pm    Post subject: Reply with quote

Code:
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:

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.
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 7:39 pm    Post subject: Reply with quote

@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:
proc script:whois1 {from key text} {
...
set text [split $text " "]
...
set topaste [join [lrange $text 1 end] " "]

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


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

PostPosted: Mon Apr 30, 2007 9:10 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Mon Apr 30, 2007 9:23 pm    Post subject: Reply with quote

Try something like this:
Code:
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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
iamdeath
Master


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

PostPosted: Mon Apr 30, 2007 9:39 pm    Post subject: Reply with quote

Code:
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 Very Happy.. 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*...
Back to top
View user's profile Send private message Visit poster's website
masheen
Voice


Joined: 28 Apr 2007
Posts: 28

PostPosted: Wed May 02, 2007 3:38 am    Post subject: Reply with quote

thanks for the fast replies and for the help. Smile i learn a lot on this one ^_^ m closing the topic.
_________________
let he who is without stone cast the first sin
Back to top
View user's profile Send private message
KEMA
Voice


Joined: 20 Nov 2006
Posts: 8
Location: indonesia

PostPosted: Sat May 05, 2007 1:18 pm    Post subject: how to to make it works to all channel that bot entry? Reply with quote

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.

Confused thx
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 -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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