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.

AOP with authcheck

Help for those learning Tcl or writing their own scripts.
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

AOP with authcheck

Post by Fraud »

Hi. after installing the following script i get this error
invalid command name "}"
while executing
"}"
invoked from within
This is the Script

Code: Select all

 setudef flag aop

   set aop(channel) "#channel"
   set aop(rawid) "678"
   bind time -|- "* * * * *" scantime

   proc scantime {minute hour day month year} {
      global aop
      bind RAW -|- {354} raw354
      if {[validchan $aop(channel)]} {
         if {[channel get $aop(channel) aop]} {
            putserv "WHO $aop(channel) n%cnahuft,$aop(rawid)"
         }
      }
   }

   proc raw354 {s r a} {
      global aop
      set rawid "[lindex [split $a] 1]"
      set chan "[string tolower [lindex [split $a] 2]]"
      set ident "[string tolower [lindex [split $a] 3]]"
      set host "[string tolower [lindex [split $a] 4]]"
      set nick "[string tolower [lindex [split $a] 5]]"
      set flags "[lindex [split $a] 6]"

      set v "*+*"
      set o "*@*"
      if {[string equal -nocase $rawid $aop(rawid)]} {
         if {![string match [lindex [split $a] 7] 0] > 0} {
            set auth "[string tolower [lindex [split $a] 7]]"
               if {[channel get $chan aop] == 1} {
                  if {[string match "$o" "$flags"] == 0} {
                     pushmode $chan +o $nick
                  }
               }

            }
         }
      }
   }
d
dwickie
Halfop
Posts: 76
Joined: Sat Aug 21, 2004 8:53 am
Location: /pub/beer

Re: AOP with authcheck

Post by dwickie »

jonlar wrote:Hi. after installing the following script i get this error

invalid command name "}"
while executing
"}"
invoked from within
well, remove one } from the end
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

   proc raw354 {s r a} {
      global aop
      set rawid "[lindex [split $a] 1]"
      set chan "[string tolower [lindex [split $a] 2]]"
      set ident "[string tolower [lindex [split $a] 3]]"
      set host "[string tolower [lindex [split $a] 4]]"
      set nick "[string tolower [lindex [split $a] 5]]"
      set flags "[lindex [split $a] 6]"

      set v "*+*"
      set o "*@*"
      if {[string equal -nocase $rawid $aop(rawid)]} {
         if {![string match [lindex [split $a] 7] 0] > 0} {
            set auth "[string tolower [lindex [split $a] 7]]"
            if {[channel get $chan aop] == 1} {
               if {[string match "$o" "$flags"] == 0} {
                  pushmode $chan +o $nick
               }
            }
         }
      }
   }
In your procedure above, you treat set auth as if its a conditional if statement giving it a closing curly brace. Removing said brace and fixing the indenting should help you spot teh flaw.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

This script will not work as intended because:
1) lists start with 0 (zero), not 1.
2) the numeric should be 352, not 354
3) only undernet uses the non-standard 354
Edit:
added #3, after a bit of research I found undernet uses this numeric
this script will not work on networks that use different IRCd types from undernet
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

give this script a try:

Code: Select all

setudef flag aop

set aop(channel) "#channel"
set aop(rawid) "678"
bind time -|- "* * * * *" scantime

proc scantime {minute hour day month year} {
   global aop
   bind RAW -|- {354} raw354
   if {[validchan $aop(channel)]} {
      if {[channel get $aop(channel) aop]} {
         putserv "WHO $aop(channel) n%cnahuft,$aop(rawid)"
      }
   }
}

pproc raw354 {s r a} {
   global aop
   set a [split $a]
   set a2 [string tolower $a]
   regexp {.*? (.*?) .*? .*? .*? .*? .*? (.*?) .*?} [join a] -> rawid flags
	regexp {(.*?) .*? (.*?) (.*?) (.*?) (.*?) (.*?) .*? (.*?)} [join a2] -> bnick chan ident host nick auth
   set v "*+*"
   set o "*@*"
   if {[string equal -nocase $rawid $aop(rawid)]} {
      if {![string match $auth 0] > 0} {
         if {[channel get $chan aop]} {
            if {[string match "$o" "$flags"] == 0} {
               pushmode $chan +o $nick
            }
         }
      }
   }
}
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Cheers i will. I would like to change the script a bit

Got this but how to implement it in the authop script ?

Code: Select all

bind PUB o !aop aop_pub

   proc aop_pub {nick uhost hand chan arg} {
      set s [lindex $arg 0]
      switch $s {
         on {
            if {[channel get $chan aop]} {
               putserv "NOTICE $nick :Auto op is already \002on\002 for $chan"
            } else {
               channel set $chan +aop
               putserv "NOTICE $nick :Auto op is now \002on\002 for $chan"
            }
         }
         off { channel set $chan -aop; putserv "NOTICE $nick :Auto op is now \002off\002 for $chan" }

         default {
            if {[channel get $chan aop]} {
               putserv "NOTICE $nick :Auto op is \002on\002 for $chan"
            } else {
               putserv "NOTICE $nick :Auto op is \002off\002 for $chan"
            }
         }
      }
   }
@Dragnlord: Get this while excecuting
invalid command name "pproc"
while executing
"pproc raw354 {s r a} {
global aop
set a [split $a]
set a2 [string tolower $a]
regexp {.*? (.*?) .*? .*? .*? .*? .*? (.*?) .*?} [join a] ->..."
I want to use it on Quakenet
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

just a typo, remove one "p" from

Code: Select all

pproc raw354 {s r a} {
Elen sila lúmenn' omentielvo
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Papillon wrote:just a typo, remove one "p" from

Code: Select all

pproc raw354 {s r a} {
I didn't notice that my keyboard has "stuttered", it should indeed be "proc" instead of "pproc".
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Well its still not working. In partyline i get this

Tcl error [raw354]: can't read "rawid": no such variable
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

I spotted a few more typos (guess I shouldn't bother answering posts at 4am).

Code: Select all

proc raw354 {s r a} {
   global aop
   set a [split $a]
   set a2 [string tolower $a]
   regexp {.*? (.*?) .*? .*? .*? .*? .*? (.*?) .*?} [join $a] -> rawid flags
   regexp {(.*?) .*? (.*?) (.*?) (.*?) (.*?) (.*?) .*? (.*?)} [join $a2] -> bnick chan ident host nick auth
   set v "*+*"
   set o "*@*"
   if {[string equal -nocase $rawid $aop(rawid)]} {
      if {![string match $auth 0] > 0} {
         if {[channel get $chan aop]} {
            if {[string match "$o" "$flags"] == 0} {
               pushmode $chan +o $nick
            }
         }
      }
   }
}
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

hehe. well 4 a clock is early ;)

But its still nothing
Authed User joins the Chan and.... thats it.

Edit: well Partyline says:" Tcl error [raw354]: can't read "rawid": no such variable"

Here the whole Code

Code: Select all

setudef flag aop

set aop(channel) "#channel"
set aop(rawid) "678"
bind time -|- "* * * * *" scantime

proc scantime {minute hour day month year} {
   global aop
   bind RAW -|- {354} raw354
   if {[validchan $aop(channel)]} {
      if {[channel get $aop(channel) aop]} {
         putserv "WHO $aop(channel) n%cnahuft,$aop(rawid)"
      }
   }
} 
proc raw354 {s r a} {
   global aop
   set a [split $a]
   set a2 [string tolower $a]
   regexp {.*? (.*?) .*? .*? .*? .*? .*? (.*?) .*?} [join $a] -> rawid flags
   regexp {(.*?) .*? (.*?) (.*?) (.*?) (.*?) (.*?) .*? (.*?)} [join $a2] -> bnick chan ident host nick auth
   set v "*+*"
   set o "*@*"
   if {[string equal -nocase $rawid $aop(rawid)]} {
      if {![string match $auth 0] > 0} {
         if {[channel get $chan aop]} {
            if {[string match "$o" "$flags"] == 0} {
               pushmode $chan +o $nick
       }
            }
         } else {
            pushmode $chan +v $nick
         }
      }
   }           
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Is the bot using a really old version of TCL?
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

tested and working on undernet for me:

Code: Select all

setudef flag aop

set aop(channel) "#channel"
set aop(rawid) "678"
bind time -|- "* * * * *" scantime

proc scantime {minute hour day month year} {
   global aop
   bind RAW -|- {354} raw354
   if {[validchan $aop(channel)]} {
      if {[channel get $aop(channel) aop]} {
         putserv "WHO $aop(channel) n%cnahuft,$aop(rawid)"
      }
   }
}
proc raw354 {s r a} {
   global aop
   set a [join [split $a]]
   regexp {(.*?) (.*?) (.*?) (.*?) (.*?) (.*?) (.*?) (.*?)} $a match bnick rawid chan ident host nick flags auth
   set v "*+*"
   set o "*@*"
   if {[string equal -nocase $rawid $aop(rawid)]} {
      if {![string match $auth 0] > 0} {
         if {[channel get $chan aop] || [channel get [string tolower $chan] aop]} {
            if {[string match "$o" "$flags"] == 0} {
               pushmode $chan +o $nick
            }
         }   
      }      
   }         
}            
putlog "UnderNet AOP script loaded"
F
Fraud
Op
Posts: 101
Joined: Mon May 19, 2008 7:57 am

Post by Fraud »

Well i wrote i using it for Quakenet
I want to use it on Quakenet
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

jonlar wrote:Well i wrote i using it for Quakenet
I want to use it on Quakenet
Unfortunately you did not say that in your initial post, the script had already been written by the time you did say that.
Post Reply