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 

why tcl
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun May 13, 2012 2:12 pm    Post subject: Reply with quote

Err.. try this:
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 {![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.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sun May 13, 2012 2:30 pm    Post subject: Reply with quote

[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 ...
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun May 13, 2012 3:10 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun May 13, 2012 4:25 pm    Post subject: Reply with quote

Actually, there is:
Code:
      if {$nick neq "ChanServ"} return

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sun May 13, 2012 9:40 pm    Post subject: Reply with quote

Yes , like nml said (line 20)
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon May 14, 2012 12:17 am    Post subject: Reply with quote

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 {![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. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Mon May 14, 2012 5:17 am    Post subject: Reply with quote

[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
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue May 15, 2012 1:13 am    Post subject: Reply with quote

That's weird. I just tested this and works as should. Rolling Eyes
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Tue May 15, 2012 9:21 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed May 16, 2012 12:18 am    Post subject: Reply with quote

Is #chan a valid channel? Add the following
Code:

if {![validchan $chan]} return

before:
Code:

set csWhyList [channel get $chan csWhyList]

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Wed May 16, 2012 5:38 am    Post subject: Reply with quote

I got no errors now , but it replies the result to the telnet not to the @#chan O.o
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed May 16, 2012 9:44 am    Post subject: Reply with quote

Wait, what?! Rolling Eyes

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.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Wed May 16, 2012 10:48 am    Post subject: Reply with quote

exactly , I see the chanserv's reply on the telnet only.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed May 16, 2012 1:32 pm    Post subject: Reply with quote

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. Rolling Eyes

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

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

after:
Code:

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.
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Wed May 16, 2012 1:59 pm    Post subject: Reply with quote

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
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 -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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