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 

autop after voice by chanserv
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 8:43 am    Post subject: autop after voice by chanserv Reply with quote

hello, can someone make a script that will op anyone that's voiced by "Chanserv" when there's only the bot opped?

example:
*** join: user1
*** Chanserv sets mode: +v user1
*** bot sets mode: +o user1


ty in advance!
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 9:08 am    Post subject: Reply with quote

Code:

bind mode * "% +v" chanserv:voice

proc chanserv:voice {nick uhost hand chan mode target} {
  if {$nick != "ChanServ"} return
  pushmode $chan +o $target
}

This should do the trick.
_________________
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
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 1:22 pm    Post subject: Reply with quote

could u possible put to op the user only if the bot is the only op
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 1:43 pm    Post subject: Reply with quote

Code:

bind mode * "% +v" chanserv:voice

proc chanserv:voice {nick uhost hand chan mode target} {
  if {$nick != "ChanServ"} return
  set count 0
  set users [chanlist $chan]
  foreach user $users {
    if {[isbotnick $user]} continue
    if {[isop $user $chan]} break
  }
  if {!$count} pushmode $chan +o $target
}

Edit: fixed.
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Mon Feb 21, 2011 3:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 3:04 pm    Post subject: Reply with quote

ty, u rock Smile
Back to top
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 3:15 pm    Post subject: Reply with quote

actually i get this error

[18:17] Tcl error [chanserv:voice]: wrong # args: no script following "{!$count}" argument
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 3:29 pm    Post subject: Reply with quote

I've fixed the above code. Shouldn't I add an except for ChanServ too, or it isn't sitting on your channel?
_________________
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
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 3:38 pm    Post subject: Reply with quote

its not sitting in channel, i get this now

Tcl error [chanserv:voice]: wrong # args: extra words after "else" clause in "if" command
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 3:55 pm    Post subject: Reply with quote

There's no else statement, so what the %#&$?!? Guess I'm having another bad day..

Looks like TCL is a bit anal about "if {statement} do 1 command" thing. Anyway, here's a version that should comply with it's *rules*:
Code:

setudef flag voiceop
bind mode * "% +v" chanserv:voice

proc chanserv:voice {nick uhost hand chan mode target} {
  if {$nick != "ChanServ"} return
  if {![channel get $chan voiceop]} return
  set count 0
  set users [chanlist $chan]
  foreach user $users {
    if {[isbotnick $user]} {
      continue
    }
    if {[isop $user $chan]} {
      incr count
      break
    }
  }
  if {!$count} {
    pushmode $chan +o $target
  }
}

I should get an eggdrop to test stuff from now on. Rolling Eyes

Edit: Added 'voiceop' flag too. Razz
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Mon Feb 21, 2011 4:42 pm; edited 4 times in total
Back to top
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 4:02 pm    Post subject: Reply with quote

hehe yeah, its working now with the except that always ops the user even if there more ops besides the bot
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Mon Feb 21, 2011 4:04 pm    Post subject: Reply with quote

Code:
setudef flag voiceop

set chanserv_host "services.somenetwork.net"

bind mode * "% +v" chanserv:voice

proc chanserv:voice {nick uhost hand chan mode target} {
   if {[channel get $chan voiceop] && [string equal -nocase "ChanServ" $nick] && ![isop $target $chan] && [botisop $chan] && [string equal -nocase $::chanserv_host [lindex [split $uhost @] 1]]} {
      foreach n [chanlist $chan] {
         if {![isbotnick $n] && ![string equal -nocase "ChanServ" $n] && [isop $n $chan]} { break } { continue }
         pushmode $chan +o $target
      }
   }
}


This should work Wink

Edit: Forgot to add the exception that bot only OP the user if it is the only one opped in the channel. Also added chanset setting.. to enable.. on partyline: .chanset #yourchan +voiceop
_________________
speechles' eggdrop tcl archive


Last edited by speechles on Mon Feb 21, 2011 4:25 pm; edited 11 times in total
Back to top
View user's profile Send private message
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 4:07 pm    Post subject: Reply with quote

didnt op the user that one

PS: btw could it be to just one #chan instead of all pls ty
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 4:14 pm    Post subject: Reply with quote

Aww.. i forgot to increment the number of channel operators that have been found (the $count variable). Now it should work properly.

My apologies for the sloppy coding. Embarassed

Edit: @speechles: There's no need for:
Code:

         if {(![isbotnick $n] || ![string equal -nocase "ChanServ" $n]) && [isop $n $chan]} {
            break
         } elseif {[isbotnick $n] || [string equal -nocase "ChanServ" $n]} {

cos ChanServ isn't sitting on his channel, also, why don't you use just one 'if' statement to exclude the bot and another to check for channel op's?

If you read again what he asked for in the first place you would notice that he wanted the bot to op the user ONLY if the bot is the only channel operator. 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
.pt
Halfop


Joined: 16 Nov 2005
Posts: 71

PostPosted: Mon Feb 21, 2011 4:22 pm    Post subject: Reply with quote

im sry again, its not oping the user, doesnt give any errors
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 4:26 pm    Post subject: Reply with quote

If you copied my last code you should '.chanset #channel +voiceop' to activate it. I'm getting a bot to play with the bind mode as I'm not 100% sure about the mask, I think I can drop the need of this with something simple as:
Code:

bind mode * "#channel +v" chanserv:voice

_________________
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
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  Next
Page 1 of 2

 
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