| View previous topic :: View next topic |
| Author |
Message |
Zio_ruo Voice
Joined: 03 Sep 2009 Posts: 4 Location: Italy A__A
|
Posted: Tue Sep 22, 2009 10:42 am Post subject: /names $chan |
|
|
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  |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Sep 22, 2009 2:41 pm Post subject: |
|
|
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 |
|
 |
Zio_ruo Voice
Joined: 03 Sep 2009 Posts: 4 Location: Italy A__A
|
Posted: Tue Sep 22, 2009 3:41 pm Post subject: |
|
|
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 
Last edited by Zio_ruo on Tue Sep 22, 2009 4:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
|
| Back to top |
|
 |
Zio_ruo Voice
Joined: 03 Sep 2009 Posts: 4 Location: Italy A__A
|
Posted: Wed Sep 23, 2009 1:50 pm Post subject: |
|
|
Thank you too ^^ _________________ Pizza Pasta Mandolini e Mafia *ç*.
No  |
|
| Back to top |
|
 |
|