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 

/names $chan

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


Joined: 03 Sep 2009
Posts: 4
Location: Italy A__A

PostPosted: Tue Sep 22, 2009 10:42 am    Post subject: /names $chan Reply with quote

Hi all, i wrote this script for make a /names $chan when a user join a specific chan:

Code:
bind join - * join:raw
bind raw - 353 RAW:bla
proc join:raw { nick host hand chan } {
        if { $chan == "humanature" } {
                putserv "NAMES $chan"
                return 1}
                }
proc RAW:bla { from keyword text } {
                putserv "PRIVMSG #humanature :$text"
                }

putlog "\037BlaBOh tcl  by Zio_ruo\037"

But it works only when the bot is joining the chan (i think because the eggdrop make a right /names $chan when it joins a chan)
_________________
Pizza Pasta Mandolini e Mafia *ç*.
No Smile
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Sep 22, 2009 2:41 pm    Post subject: Reply with quote

Your bot is receiving the RAW 353 as an automatic response from the server when joining a channel, and not as a consequence of the code within your join proc. Your join proc does not work for any user INCLUDING the bot.

Code:

if {$chan == "humannature"} {
  # code here
}


In the above statement, there is no # in front of the channel name and in any case it is inadvisable to use such an equality test because it does not allow for differences in case. For example, the bot may know the channel as #Humanature rather than #humanature.

The following equality test is better

Code:

if {[string equal -nocase $chan #humanature]} {
  # code here
}


You might also want to prevent the code from triggering when the bot joins, since it will receive the RAW 353 automatically anyway.

The following code should work

Code:

bind JOIN - * pUserJoin
bind RAW - 353 pRaw353

proc pUserJoin {nick uhost hand chan} {
    if {![isbotnick $nick]} {
        if {[string equal -nocase $chan #humanature]} {
            putserv "NAMES $chan"
        }
    }
    return 0
}

proc pRaw353 {from keyword text} {
    putserv "PRIVMSG #humanature :$text"
    return 0
}

putlog "\037BlaBOh tcl  by Zio_ruo\037"


Alternatively you could have put the channel name in the JOIN bind mask. If I am not mistaken this is not case sensitive. There is good reason for this. The command 'string equal' is from the Core Tcl language where there is no concept of what an IRC channel is. However, a JOIN bind and associated mask is from Eggdrop TCL where the mask is expected to begin with an IRC channel name, for which case is irrelevant.

Code:

bind JOIN - "#humanature *" pUserJoin
bind RAW - 353 pRaw353

proc pUserJoin {nick uhost hand chan} {
    if {![isbotnick $nick]} {
        putserv "NAMES $chan"
    }
    return 0
}

proc pRaw353 {from keyword text} {
    putserv "PRIVMSG #humanature :$text"
    return 0
}

putlog "\037BlaBOh tcl  by Zio_ruo\037"

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
Zio_ruo
Voice


Joined: 03 Sep 2009
Posts: 4
Location: Italy A__A

PostPosted: Tue Sep 22, 2009 3:41 pm    Post subject: Reply with quote

Thank you so much *_*
It works but there is a little problem:

Quote:
(21:06:44) [Part] Zio_ruo (-@stfu.omfgwtfbbq.org)
(21:06:44) [Join]: Ora sei in #humanature
(21:06:46) <@Jagannath> Jagannath @ #humanature :@Zio_ruo @Hanky_Panky @Jagannath
(21:06:47) <@Jagannath> Jagannath @ #humanature :@Zio_ruo @Hanky_Panky @Jagannath


However i have stupid domand °°:
Code:
        if {[string equal -nocase $chan #humanature]} {

Can i find stuff like this in eggdrop /doc or in tcl tutorials ?_?
_________________
Pizza Pasta Mandolini e Mafia *ç*.
No Smile


Last edited by Zio_ruo on Tue Sep 22, 2009 4:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Tue Sep 22, 2009 4:16 pm    Post subject: Reply with quote

find it at

http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
for tcl 8.5

or
http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm
for tcl 8.4

nevertheless its almost the same
Back to top
View user's profile Send private message
Zio_ruo
Voice


Joined: 03 Sep 2009
Posts: 4
Location: Italy A__A

PostPosted: Wed Sep 23, 2009 1:50 pm    Post subject: Reply with quote

Thank you too ^^
_________________
Pizza Pasta Mandolini e Mafia *ç*.
No Smile
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 -> 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