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.

Mass op +o via dcc command.

Old posts that have not been replied to for several years.
Locked
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Mass op +o via dcc command.

Post by Gothic-Angel »

I want to throw together a tcl to mass op all +o users on $chan via dcc commands to op everyone not opped in #chan who's o|o.

What would be the best way to go about doing this? The channel I want this for is +bitch.

I'd rather get suggestions or snippets of code so I can actually put this together so please dont paste a fix just throw out ideas or snippets of what I should start off with and what not.

Thanks a lot for the help.
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

i didnt understand ur request but i supposed the answer is
.chanset #channel +autoop ( this will op the persons whith +o flagwhen joining the channel)
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

I dont want the channel +autoop, I want a tcl to mass op +o users via dcc command.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hint: foreach combined with chanlist
Once the game is over, the king and the pawn go back in the same box.
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

Code: Select all

bind dcc nm|nm mop mass:op
set chanz "#jjrd"

proc mass:op {nick idx host hand args} {
global chanz botnick botnet-nick
if {![onchan $botnick $chanz]} { continue }
foreach nick [chanlist $chanz] {
if {[isbotnick $nick] || [isop $nick $chanz] } { continue }
if {[matchattr $handle +o] } { putmode +o $chanz $nick }}
}
I haven't tested it that was a first draft of something in my head just though id do it in this lil box but im sure you could hint me towards a better way to do this. Im kinda new to tcl so im trying to learn and accomplish my goal to finish this :o
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

Well this seems to work out well

Code: Select all


bind dcc nm|nm mop mass:op
set chanz "#jjrd"

proc mass:op {hand idx args} {
global chanz botnick botnet-nick
if {![onchan $botnick $chanz]} { continue }
foreach nick [chanlist $chanz] {
if {[isbotnick $nick] || [isop $nick $chanz] } { continue }
if {[matchattr $hand +o] } { pushmode $chanz +o $nick }}
}
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I suppose you can use [chanlist $chans o|o] to get only +o users in $chanz.
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

Seems like this mass opped everyone which I dont want. hmm

I dont see where I went wrong so if anyone could point me in the right direction Id really appreciate it.

Thanks again for all the help.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hints:
1. You can use [botonchan $chanz] instead of [onchan $botnick $chanz].
2. You have called globaly botnet-nick but you don't seem to be needing it there.
3. Call a global variable like $::chanz instead of calling it with global chanz line. This way the chanz variable is called when is needed not when the proc is beeing procesed.
4. Please be more careful with the procs, I mean read how many and what arguments they should have.
Instead of
proc mass:op {nick idx host hand args} {
should be:
proc mass:op {hand idx args} {
As for the code, try something like this:

Code: Select all

bind dcc nm|nm mop mass:op 
set chanz "#jjrd" 

proc mass:op {hand idx text} { 
  if {![botonchan $::chanz] || ![botisop $::chanz]} {
    continue
  } 
  foreach nick [chanlist $::chanz o|o] { 
    if {[isbotnick $nick] || [isop $nick $::chanz]} {
      continue
    } 
    pushmode $::chanz +o $nick
  }
} 
is working fine at me.
Once the game is over, the king and the pawn go back in the same box.
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

I did go back and correct my proc I was just running into a problem of opping non ops.

So setting up a variable like I did with chanz ::chanz makes it so I it calls on the variable without needing a global line?
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

I really do appreciate the help, im trying to learn Im not doing a bad job its kinda frustrating but hey, takes a lil bit of frustration to get it all down.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

global bla ; putlog $bla is the same thing as: putlog $::bla
If in your proc, let's say this one:

Code: Select all

proc bla {} {
global moo bla
if {$moo = 2} { return }
putlog $bla
}
the moo and the bla variables will be called and memored while something like:

Code: Select all

proc bla {} {
if {$::moo = 2} { return }
putlog $::bla
}
the moo and bla variables will be called only when needed. The difference betwen global and the use of $:: had been discussed before, If I recall corectly. No problem, I've had some bad days also, probably you are having one.
Once the game is over, the king and the pawn go back in the same box.
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

It just felt like I was hacking and chomping through that tcl and I wasnt getting it right.

I kinda felt like I was beating my way through a jungle with an unsharpned Machette :(
User avatar
duofruo
Halfop
Posts: 94
Joined: Thu Oct 23, 2003 3:17 pm
Location: Ploiesti@.ro
Contact:

Post by duofruo »

That was a cool fraze, i will remember that :)
Locked