All the code below does is change some of the inefficiencies I mentioned above plus insert some strategic echoes to status window. If it no longer freezes 5-10 sec, then it's because of the inefficiencies like calculating $nick(channel,0) 1000 times if there's 1000 nicks, or using the $regsubex parameters multiple times for the same inputs. It doesn't fix the issues where you're assuming that these 6 on/off modes are going to be paired with a parameter that looks like one of these wildcard-banmasks, which I showed isn't necessarily true. And that your code shows as if all nicks in %bl are affected by all 6 modes.
But, if it's still freezing, you should see from status window where the ticks count has a milliseconds gap that shouldn't be there. Note the ticks times are all a 'count up' of the total time from the beginning, and not showing the interval since the last echo

Code
ON ^*:RAWMODE:#:{
  echo -t $chan  12,08 $nick 1,15 Sets Mode on  5,15 $chan 1,15 to: 12,15  $strip($1-,bcru)  
  var %b = $countcs($1,b,e,I,q),%y = 1 , %start.time $ticksqpc
  if (%b) {
    while (%y <= %b) {
      var %x = 1 , %nick.count $nick($chan,0)
      while (%x <= %nick.count) {
        var %banmask = $wildtok($2-,*!*@*,%y,32) 
        if (~quiet:?* iswm %banmask) var %banmask $mid(%banmask,8)   
        elseif (~?:?* iswm %banmask) var %banmask $mid(%banmask,4) 
        elseif (?:?* iswm %banmask) var %banmask $mid(%banmask,3)
        if (%banmask iswm $address($nick($chan,%x),5)) var %bl = %bl $nick($chan,%x)
        inc %x
      }
echo -s line $scriptline ticks $calc($ticksqpc - %start.time) y %y < b %b nicks %nick.count
      inc %y
    }
    if (%bl) {

var %bl.count $numtok(%bl,32) , %user User , %is Is
if (%bl.count > 1) var %user Users, %is Are

var %regsubex $regsubex(%bl,/(\S+)/g,( $+ \n $+ ) \t )
var %i 1 | while ($query(%i)) {
var %query $v1 | if ($istok(%bl,%query,32)) echo -t %query 01,00 *** ( $+ %bl.count %user $+ ) %Is effected 12 %regsubex 14  05 $1-  
inc %i }
echo -s line $scriptline ticks $calc($ticksqpc - %start.time) query+1 %i bl.count %bl.count
      if (($me isin %bl) && (+q isin $1)) { mode # set $replace($1-,+,-) }
      if ( +b isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is Banned  04,00 %regsubex   
      if ( -b isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is UNBanned  04,00 %regsubex     
      if ( +I isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is Invited  04,00 %regsubex   
      if ( -I isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is UNInvited  04,00 %regsubex     
      if ( +e isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is exempted  04,00 %regsubex   
      if ( -e isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is UNexempted  04,00 %regsubex     
      if ( +q isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is MuteBanned 04,00 %regsubex   
      if ( -q isin $1)  echo $chan $timestamp 08,14 ( $+ %bl.count %user $+ ) %is UN-MuteBanned  04,00 %regsubex     
    }
  }
  haltdef
echo -s line $scriptline ticks $calc($ticksqpc - %start.time) finish
}



edit: edited the last elseif out. I got carried away with changing the if's to elseif's
edited again for missing parenthesis in %regsubex

Last edited by maroon; 14/09/22 03:55 PM.