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.

why tcl

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

why tcl

Post by Amr »

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.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

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.
Last edited by caesar on Sun May 13, 2012 6:32 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

I got this error

[08:45:38] Tcl error [::csWhy::checkReply]: syntax error in expression "$nick neq "ChanServ"": variable references require preceding $
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

if {$nick neq "ChanServ"} return 
with:

Code: Select all

if {![string equal $nick "ChanServ"]} return 
Once the game is over, the king and the pawn go back in the same box.
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

new error appears [16:37:55] Tcl error [::csWhy::checkReply]: can't read "chan": no such variable
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

Here we go : ChanServ - Samprite2 has FOUNDER access to #alex. Reason: Identification to services with the channel password. Channel Frozen: NO
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

and we got another one dim has SOP access to #alex. Reason: Identification to the nickname AutoCross. Channel Frozen: NO
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

set csWhyList [channel get $chan csWhyList]
NML_375
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

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.
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

please , can you type the whole fixed one ?
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

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
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

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 ...
Post Reply