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 

output results in alpabetical order

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


Joined: 22 Mar 2015
Posts: 438

PostPosted: Mon Apr 27, 2020 8:15 am    Post subject: output results in alpabetical order Reply with quote

i was wondering if the output could be in alphabetical order as it doesnt seem to be as is:

Code:


bind pub n|n .mcheck check_all

set excnickX2 {
   "chanserv"
}




proc check_all {nick host handle chan text} {
   global excnickX2

   # grab the channel members list and exclude the bot from it
   set userList [chanlist $chan]
   set pos [lsearch -nocase $userList $::botnick]
   set userList [lreplace $userList $pos $pos]

   # set kick reason
   set reasonX55 [join [lrange [split $text ] 0 end]]
   if {$reasonX55 eq ""} { set reasonX55 Requested }

   # build the list with only people that arent on chan access list
   foreach user [split $userList] {
      if {![isvoice $user $chan] && ![isop $user $chan] && ![ishalfop $user $chan] && ![matchattr [nick2hand $user] fnmo|fnmo $chan] && [lsearch -nocase $excnickX2 $user] == -1} {  lappend voiceList $user }
   }

   set max 4

   if {[info exists voiceList]} {
      set len [llength $voiceList]
      while {$len > 0} {
         if {$len > $max} {
            set mode [string repeat "v" $max]
            set users [join [lrange $voiceList 0 [expr {$max - 1}]]]
            set voiceList [lrange $voiceList $max end]
            incr len -$max
         } else {
            set users [join $voiceList]
            set len 0
         }
         putserv "NOTICE $nick [join $users ","]"
      }
      puthelp "NOTICE $nick :ALL non Voiced/opped/halfopped users on $chan."
   } else {
      puthelp "NOTICE $nick :No Voiced/opped/halfopped on $chan."
   }
}


so output meaning the putserv "NOTICE $nick [join $users ","]"

thnx in advance
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 632
Location: Tennessee, USA

PostPosted: Mon Apr 27, 2020 11:35 am    Post subject: Reply with quote

Use the lsort command to sort lists in tcl.
http://www.tcl.tk/man/tcl8.5/TclCmd/lsort.htm

Try sorting the list after your check if it does exist...
Code:

   if {[info exists voiceList]} {
      set voiceList [lsort -dictionary $voiceList]


_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 438

PostPosted: Mon Apr 27, 2020 3:02 pm    Post subject: Reply with quote

thanks spike^^ that seems to do it
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
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