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.

Problem with Chanxs.tcl

Old posts that have not been replied to for several years.
Locked
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Problem with Chanxs.tcl

Post by kain »

While looking through a load of scripts I found Chanxs.tcl by egghead, it was originally posted here
I loaded it and tried it, but it only lists global flags when it should list channel flags, and I cant see why.
heres the code:

Code: Select all

#---------------------------------------------------------------------
# chanxs.tcl
#
# Tcl script for IRC bot eggdrop.
# Usage: !chanxs
# Displays the access levels to the channel of all users in the 
# userlist. 
#
# v0: 25-Oct-2002
#---------------------------------------------------------------------

package require eggdrop 1.6
package require Tcl 8.0

bind PUB m|m !chanxs showchanusers

proc showchanusers { nick uhost hand chan text } {

   # the flaglist in order of importance!

   set flaglist {n m o f v}

   # flagnames are used when outputting the results.

   set flagname(n) owner
   set flagname(m) master
   set flagname(o) operator
   set flagname(f) friend
   set flagname(v) voice

   # review all users in the userlist

   foreach user [userlist] {

      foreach flag $flaglist {

         # check if user has global or channel access. 

         if {[matchattr $user $flag $chan]} { 

            # check if the user is on the channel

            set usernick [hand2nick $user $chan]

            if { $usernick != "" && $usernick != $user } {

               set user "$user (aka $usernick)"

            }

            lappend userswithflag($flag) $user

            break
         }
      }
   }

   # any results?

   if { ![array exists userswithflag] } {

      puthelp "PRIVMSG $chan :\002userlist\002: no results."

      return 1

   }

   # output header

   set line "([ctime [unixtime]]) userlist results for $chan:"

   puthelp "PRIVMSG $chan :\002$line\002"

   # output all results.

   foreach flag $flaglist { 

      if {![info exists userswithflag($flag)]} { continue }

      # a flagname was set?

      if { ![info exists flagname($flag)] } { 

         set flagname($flag) "Flag $flag"

      }

      # join the list to a string

      set list $userswithflag($flag)

      set list [lsort -ascii -increasing $list]

      set line [join $list ", "]

      # limit the string length.

      if {[string length $line] > 300 } {

         set line "[string range $line 0 300] ..."

      }

      puthelp "PRIVMSG $chan :\002$flagname($flag)\002: $line"

   }

   # output footer.

   set line "End of userlist results for $chan."

   puthelp "PRIVMSG $chan :\002$line\002"

   # log the request.

   return 1

}

putlog "Userlist version 0 loaded."
Any ideas?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: Problem with Chanxs.tcl

Post by egghead »

kain wrote:While looking through a load of scripts I found Chanxs.tcl by egghead, it was originally posted here
I loaded it and tried it, but it only lists global flags when it should list channel flags, and I cant see why.
Kain, the script uses the matching system of eggdrop. So you modify to the following if you want global ops and local ops listed together:

Code: Select all

...
set flaglist {n m o|o f v}
...
set flagname(o|o) operator
...
k
kain
Halfop
Posts: 91
Joined: Fri Mar 15, 2002 8:00 pm
Contact:

Post by kain »

Ahh, I see now, I glanced over that.
I think I need more sleep, or less drink when looking at tcl. :oops:
Locked