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 

$botnick command

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Mon Jan 05, 2009 4:15 pm    Post subject: $botnick command Reply with quote

does anybody know (code) how can I make the egg to respond on commands like: botnick op, botnick voice .... instead of !op and !voice
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Tue Jan 06, 2009 5:07 pm    Post subject: Reply with quote

Code:

bind pubm o|o "$botnick op *" pubm:op

proc pubm:op {nick host hand chan text} {
set target [lindex [split $text] 2]
pushmode $chan +o $target
}


if you know a very little about scripting, you could write the other commands by editing this template Very Happy
[/code]


Last edited by Nimos on Wed Jan 07, 2009 7:03 am; edited 1 time in total
Back to top
View user's profile Send private message
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Wed Jan 07, 2009 6:18 am    Post subject: Reply with quote

something is wrong ... it doesn't work .

I've added this command in my lol script and it dowsnt respond on commands
Code:

bind pub o|o .op pub_lol_op
bind pub o|o "$botnick op" pub_lol_op
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Wed Jan 07, 2009 7:05 am    Post subject: Reply with quote

I dont know lol script, but your new bind has 2 words instead of one, thats the problem^^
Back to top
View user's profile Send private message
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Wed Jan 07, 2009 7:08 am    Post subject: Reply with quote

Nimos wrote:
I dont know lol script, but your new bind has 2 words instead of one, thats the problem^^

i just replaces: !op with "$botnick op *" .. and nothing hapens
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Wed Jan 07, 2009 7:19 am    Post subject: Reply with quote

try without the asterisk then...that was for pubm bind only
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Wed Jan 07, 2009 9:02 am    Post subject: Reply with quote

Thats the wrong way to go about it, use something like this:

Code:
bind pubm o|o {*} bot:cmds

proc bot:cmds {nick host hand chan text} {
    global botnick
    if {![string equal -nocase $botnick [lindex [split $text] 0]]} { return }
    set cmd [lindex [split $text] 1]
    set arg [join [lrange $text 2 end]]
    switch -exact -- $cmd {
      "op"
          set who [lindex [split $arg] 0]
          if {![onchan $who $chan]} {
            putserv "NOTICE $nick :ERROR: $who is not on $chan."
          } elseif {![botisop $chan]} {
            putserv "NOTICE $nick :ERROR: I require op to do that!"
          } elseif {[isop $who $chan]} {
            putserv "NOTICE $nick :ERRRR: $who is already op on $chan."
          } else {
            putserv "MODE $chan +o $who"
            putserv "NOTICE $nick :Done. Op'd $who on $chan."
          }
       }
       "deop"
          set who [lindex [split $arg] 0]
          if {![onchan $who $chan]} {
            putserv "NOTICE $nick :ERROR: $who is not on $chan."
          } elseif {![botisop $chan]} {
            putserv "NOTICE $nick :ERROR: I require op to do that!"
          } elseif {![isop $who $chan]} {
            putserv "NOTICE $nick :ERRRR: $who is not op'd on $chan."
          } else {
            putserv "MODE $chan -o $who"
            putserv "NOTICE $nick :Done. Deop'd $who on $chan."
          }
       }
       "default" {
            putserv "NOTICE $nick :SYNTAX: $botnick <command> ?arguements?"
            putserv "NOTICE $nick :Available commands: op|deop."
       }
    }
}

putlog "Loaded botnick commands!"
       


This is untested, just an example to show you how to do it..
_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Danik
Halfop


Joined: 15 Jun 2008
Posts: 49
Location: Moldova

PostPosted: Wed Jan 07, 2009 11:04 am    Post subject: Reply with quote

I just need the code to replace this
Code:
bind pub o|o .op pub_lol_op


with the: botnick op.

because i use the lol script
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Wed Jan 07, 2009 3:40 pm    Post subject: Reply with quote

bind pubm o|o "$botnick op" pub_lol_op_2

proc pub_lol_op_2 {nick host hand chan text} {
pub_lol_op "$nick $host $hand $chan [lrange [split $text] 2 end]"
}

do this for every lol script bind -.-
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Wed Jan 07, 2009 7:51 pm    Post subject: Reply with quote

Let me explain what i meant about going about it the wrong way.

Binding to $botnick is very well ok. but it will also error because $botnick is in the global namespace, so you need to call it via $::botnick

When your botnick changes nickname on irc, lets say from its alt-nick to its main nickname, the binds will still be bound to the alt-nick, which defeats the object of botnick commands.

Its not hard work to port lol-tools commands into my example, just reply the code inside:

Code:
"<command>" {
             ....
         }


With:
Code:
"<command>" {
             catch {procname $nick $host $hand $chan $arg}
         }


For exampe, for op:

Code:
"op" {
             catch {pub_lol_op $nick $host $hand $chan $arg}
         }

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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