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

Post by caesar »

Err.. try this:

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 {![string equal $nick "ChanServ"]} return 
      set pos [lsearch $csWhyList $user]
      set csWhyList [lreplace $csWhyList $pos $pos]
      channel set $chan csWhyList $csWhyList
      puthelp "NOTICE @$chan :$text"
   }
} 
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 »

[20:29:38] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ...
[20:29:38] -ChanServ (service@dal.net)- nick has SOP access to #chan. Reason: Identification to the nickname nick. Channel Frozen: NO
[20:29:38] Tcl error [::csWhy::checkReply]: invalid bareword "neq"
in expression "$nick neq "ChanServ"";
should be "$neq" or "{neq}" or "neq(...)" or ...
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

There's no "neq" in the last piece of code I've posted above. Make sure you copy/paste it right and load that file on the bot then rehash it.
Once the game is over, the king and the pawn go back in the same box.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Actually, there is:

Code: Select all

      if {$nick neq "ChanServ"} return
NML_375
User avatar
Amr
Halfop
Posts: 94
Joined: Fri Sep 14, 2007 7:13 am
Location: Egypt

Post by Amr »

Yes , like nml said (line 20)
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 {![string equal $nick "ChanServ"]} return
		set text [split $text]
		set user [lindex $text 0]
		set chan [string trim [lindex $text 5] {.}]
		set csWhyList [channel get $chan csWhyList]
		set pos [lsearch $csWhyList $user]
		if {$pos == -1} return
		set csWhyList [lreplace $csWhyList $pos $pos]
		channel set $chan csWhyList $csWhyList
		puthelp "NOTICE @$chan :$text"
	}
}
There. Was tiered so mixed a few lines and forgot a few things. It should work now. Hopefully. :)
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 »

[11:16:38] Tcl error [::csWhy::checkReply]: no such channel record
[11:16:38] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

That's weird. I just tested this and works as should. :roll:
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 tried it again but it gives the same error.

[11:16:38] Tcl error [::csWhy::checkReply]: no such channel record
[11:16:38] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Is #chan a valid channel? Add the following

Code: Select all

if {![validchan $chan]} return
before:

Code: Select all

set csWhyList [channel get $chan csWhyList]
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 no errors now , but it replies the result to the telnet not to the @#chan O.o
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Wait, what?! :roll:

So, you see the reply (notice) from ChanServ and the bot itself repeats the same line in the telnet, or you see only ChanServ's reply?
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 »

exactly , I see the chanserv's reply on the telnet only.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Since the channel variable is set correctly:
tclsh wrote: % set text "nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO"
nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO
% string trim [lindex [split $text] 5] {.}
#chan
I don't get it why it says #chan is not valid. :roll:

Let's do a little debug of the chan variable by adding:

Code: Select all

putlog "cswhy.tcl debug - chan is: $chan"
after:

Code: Select all

set chan [string trim [lindex $text 5] {.}] 
and report back what you get in telnet.
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
[19:55:49] cswhy.tcl debug - chan is: #chan
[19:55:49] -ChanServ (service@dal.net)- nick has FOUNDER access to #chan. Reason: Identification to the founder's nickname, nick. Channel Frozen: NO

And I got this on telnet on channel which the script is disabled in.

[19:56:18] cswhy.tcl debug - chan is: xeo
Post Reply