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 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
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Wed May 09, 2012 9:24 am    Post subject: why tcl Reply with quote

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


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

PostPosted: Thu May 10, 2012 12:45 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 {$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
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 12, 2012 2:47 am    Post subject: Reply with quote

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


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

PostPosted: Sat May 12, 2012 5:41 am    Post subject: Reply with quote

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


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 12, 2012 10:38 am    Post subject: Reply with quote

new error appears [16:37:55] Tcl error [::csWhy::checkReply]: can't read "chan": no such variable
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat May 12, 2012 2:55 pm    Post subject: Reply with quote

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


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 12, 2012 3:07 pm    Post subject: Reply with quote

Here we go : ChanServ - Samprite2 has FOUNDER access to #alex. Reason: Identification to services with the channel password. Channel Frozen: NO
Back to top
View user's profile Send private message
Amr
Halfop


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 12, 2012 3:08 pm    Post subject: Reply with quote

and we got another one dim has SOP access to #alex. Reason: Identification to the nickname AutoCross. Channel Frozen: NO
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat May 12, 2012 3:11 pm    Post subject: Reply with quote

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


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sat May 12, 2012 3:14 pm    Post subject: Reply with quote

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


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

PostPosted: Sun May 13, 2012 6:33 am    Post subject: Reply with quote

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


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sun May 13, 2012 9:07 am    Post subject: Reply with quote

please , can you type the whole fixed one ?
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 11:35 am    Post subject: Reply with quote

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


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

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

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


Joined: 14 Sep 2007
Posts: 94
Location: Egypt

PostPosted: Sun May 13, 2012 1:11 pm    Post subject: Reply with quote

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
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 1, 2, 3  Next
Page 1 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