| View previous topic :: View next topic |
| Author |
Message |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Wed May 09, 2012 9:24 am Post subject: why tcl |
|
|
hello guys , anyone got a tcl script which do "/cs why #chan nick" whenever anyone get oped in the channel and then do "/notice @#chan" with the result.
thanks. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu May 10, 2012 12:45 am Post subject: |
|
|
| Code: |
namespace eval csWhy {
setudef str csWhyList
setudef flag cswhy
bind mode * "% +o" [namespace current]::checkWhy
bind notc * * [namespace current]::checkReply
# someone got OP'ed on the channel
proc checkWhy {nick uhost hand chan mode target} {
if {[isbotnick $target]} return
if {![channel get $chan cswhy]} return
set csWhyList [channel get $chan csWhyList]
lappend csWhyList $target
channel set $chan csWhyList $csWhyList
puthelp "ChanServ WHY $chan $target"
}
# reply of WHY command from ChanServ
proc checkReply {nick uhost hand text {dest ""}} {
if {[string equal -length 1 # $dest]} return
if {$nick neq "ChanServ"} return
set text [split $text]
set user [lindex $text 0]
set chan [string trim [lindex $text 5] {.}]
set csWhyList [channel get $chan csWhyList]
if {$nick ni $csWhyList} return
set pos [lsearch $csWhyList $user]
set csWhyList [lreplace $csWhyList $pos $pos]
channel set $chan csWhyList $csWhyList
puthelp "NOTICE @$chan :$text"
}
}
|
Do a .chanset #channel +cswhy for the channel you wish this to be activated.
Haven't tested it so let me know if you get any errors.
Edit: fixed. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Sun May 13, 2012 6:32 am; edited 1 time in total |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 12, 2012 2:47 am Post subject: |
|
|
I got this error
[08:45:38] Tcl error [::csWhy::checkReply]: syntax error in expression "$nick neq "ChanServ"": variable references require preceding $ |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat May 12, 2012 5:41 am Post subject: |
|
|
There are two ways to fix this. One is to install the latest version of TCL library and the second is to just replace:
| Code: |
if {$nick neq "ChanServ"} return
|
with:
| Code: |
if {![string equal $nick "ChanServ"]} return
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 12, 2012 10:38 am Post subject: |
|
|
| new error appears [16:37:55] Tcl error [::csWhy::checkReply]: can't read "chan": no such variable |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat May 12, 2012 2:55 pm Post subject: |
|
|
That's weird. From a link to Dalnet's documentation that I can't find right now the channel vas stored in the 5th word. Could you do a WHY on someone and reply back with the message you get from ChanServ? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 12, 2012 3:07 pm Post subject: |
|
|
| Here we go : ChanServ - Samprite2 has FOUNDER access to #alex. Reason: Identification to services with the channel password. Channel Frozen: NO |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 12, 2012 3:08 pm Post subject: |
|
|
| and we got another one dim has SOP access to #alex. Reason: Identification to the nickname AutoCross. Channel Frozen: NO |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat May 12, 2012 3:11 pm Post subject: |
|
|
Easily overlooked, but you're trying to read chan before you set it.
This line must come after you set chan (currently on line 7 of checkReply).
| Code: | | set csWhyList [channel get $chan csWhyList] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 12, 2012 3:14 pm Post subject: |
|
|
I got this error after enable the script to work on specific channel;
[21:13:40] Tcl error [::csWhy::checkReply]: can't read "chan": no such variable
[21:13:40] -ChanServ (service@dal.net)- Usage: WHY <channel> <nick>
[21:13:40] Tcl error [::csWhy::checkReply]: can't read "chan": no such variable
[21:13:40] -ChanServ (service@dal.net)- For help, /msg ChanServ@services.dal.net HELP WHY |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 13, 2012 6:33 am Post subject: |
|
|
nml375 is right, duno how I missed that. I've fixed this and adjusted the WHY command accordingly. Test it and report back.
Please do notice that you will have to replace the
| Code: |
if {$nick neq "ChanServ"} return
|
line like I've previously mentioned. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sun May 13, 2012 9:07 am Post subject: |
|
|
| please , can you type the whole fixed one ? |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sun May 13, 2012 11:35 am Post subject: |
|
|
we got another error
[17:31:48] Tcl error [::csWhy::checkReply]: can't read "csWhyList": no such variable
[17:31:48] -ChanServ (service@dal.net)- Usage: WHY <channel> <nick>
[17:31:48] Tcl error [::csWhy::checkReply]: can't read "csWhyList": no such variable
[17:31:48] -ChanServ (service@dal.net)- For help, /msg ChanServ@services.dal.net HELP WHY |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun May 13, 2012 12:46 pm Post subject: |
|
|
Are you sure you got the fixed code I've edited above and rehashed the bot? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sun May 13, 2012 1:11 pm Post subject: |
|
|
Ya I got it , but another error appears
[19:10:09] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ...
[19:10:10] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ... |
|
| Back to top |
|
 |
|