;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;info: ; by wiebe @ QuakeNet ; ; version 1.0 (written and tested on mIRC 6.14) ; last edit: Wed Mar 24 2004 ; ; ;What does this script do? ; ; puts users in a queue, (half)ops can voice them with !next ; ; * this script needs pushmode ; ; ;How to use this script? ; ; !queue on ; starts the queue ; ; !queue off ; stops the queue ; ; !queue status ; shows how many users there are in the queue ; ; !next ; to voice the next user ; ; !next N ; to voice the next N users ; ; !done nick1 nick2 nick3 ... nickN ; to devoice the given nicks ; ; !done -all ; to devoice all ; ; done and !next can be used on 1 line ; for example: !next 5 !done nick1 nick2 ; ; done nick1 nick2 !next 5 ; ; users can use the commands QUEUEME and REMOVEME in private to be added/removed from the queue ; ; a voiced user can also do !done to be devoice ; ; when users are voiced, they are highlighted in the channel with a message ; ; when a user is voiced, the user gets a notice telling he is being voiced and should state his question ; ; the script can send to the ops on the channel a report notice, telling them how many are in the queue/voiced ; delay can be set below ; ; script can work on only one channel ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.CHAN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.chan { ; set here the channel where is script should be active return #channel } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.RDELAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.rdelay { ; set here the reporting status delay ; leave empty to disable return } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.ADELAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.adelay { ; set here the announce delay ; this will message the channel with how the queue works ; leave empty to disable return } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !QUEUE ON TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!queue on:#:{ ; check channel, me is op or halfop, nick is op or halfop if ($chan == $next.chan) && (($me isop $chan) || ($me ishop $chan)) && (($nick isop $chan) || ($nick ishop $chan)) { ; group is disabled, enable it, set +m, send a message if ($group(#next) == off) { .enable #next pushmode $chan +m msg $chan User queue is ON. Users are added to the queue on join. Users already in the channel can add themselves with "/MSG $me QUEUEME". To remove yourself at anytime use "/MSG $me REMOVEME". ; check setting and start timer if ($next.adelay > 0) { .timer $+ $cid $+ .next.announce 1 $next.adelay next.announce } ; check setting and start timer if ($next.rdelay > 0) { .timer $+ $cid $+ .next.report 1 $next.rdelay next.report } } ; group is enabled, send notice else { cnotice $nick $chan Queue status: ON } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !QUEUE OFF TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!queue off:#:{ ; check chan, me is op or halfop, nick is op or halfop if ($chan == $next.chan) && (($me isop $chan) || ($me ishop $chan)) && (($nick isop $chan) || ($nick ishop $chan)) { ; group is enabled, disable the group, set -m, devoice all users, send message, remove all ialmarks if ($group(#next) == on) { .disable #next pushmode $chan -m var %x = $nick($chan,0,v,oh) while (%x) { pushmode $chan -v $nick($chan,%x,v,oh) dec %x } msg $chan Queue status: OFF .timer [ $+ [ $cid ] $+ ] .next.report off .timer [ $+ [ $cid ] $+ ] .next.announce off var %x = $nick($chan,0,r) while (%x) { .ialmark $nick($chan,%x,r) $remove($ial($nick($chan,%x,r)).mark,$wildtok($ial($nick($chan,%x,r)).mark,$+(next-,$hash($chan,32),-*),1,32)) dec %x } } ; group is disabled, send notice else { cnotice $nick $chan Queue status: OFF } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !QUEUE STATUS TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!queue status:#:{ ; check chan, me is op or halfop, nick is op or halfop if ($chan == $next.chan) && (($me isop $chan) || ($me ishop $chan)) && (($nick isop $chan) || ($nick ishop $chan)) { ; group is enabled, get the numbers and send notice if ($group(#next) == on) { var %q = $next.status($chan), %n = $nick($next.chan,0,v,oh) cnotice $nick $chan Queue status: $iif(%q == 1,%q user,%q users) queued, $iif(%n == 1,%n user,%n users) being helped } ; group is disabled, send notice else { cnotice $nick $chan Queue status: OFF } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !DONE TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!done*:#:{ ; check chan, !done is used, me is op or halfop if ($chan == $next.chan) && ($1 == !done) && (($me isop $chan) || ($me ishop $chan)) { ; nick uses !done, nick is voice but not opped or halfopped, devoice user if ($2 == $nick) && ($nick isvoice $chan) && ($nick !isop $chan) && ($nick !ishop $chan) { pushmode $chan -v $nick } ; nick is op or halfop, no param given, 1 voice, devoice that user elseif (($nick isop $chan) || ($nick ishop $chan)) { done $remove($2- [ $+ [ $calc($findtok($1-,!next,1,32) -1) ] ],!next) if ($findtok($1-,!next,1,32)) { next $gettok($ [ $+ [ $findtok($1-,!next,1,32) $+ - ] ],2,32) } } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS DONE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l done { ; -all is used, loop, devoice all voices if ($1 == -all) { var %x = $nick($chan,0,v,oh) while (%x) { pushmode $chan -v $nick($chan,%x,v,oh) dec %x } } elseif (!$1) && ($nick($chan,0,v,oh) == 1) { pushmode $chan -v $nick($chan,1,v,oh) } ; else, devoice all given nicks else { while ($1) { if ($1 isvoice $chan) && ($1 !isop $chan) && ($1 !ishop $chan) { pushmode $chan -v $1 } tokenize 32 $2- } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; START GROEP #NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #next on ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !NEXT TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:text:!next*:#:{ ; check chan, !next, me is op or halfop, nick is op or halfop if ($chan == $next.chan) && ($1 == !next) && (($me isop $chan) || ($me ishop $chan)) && (($nick isop $chan) || ($nick ishop $chan)) { next $2- [ $+ [ $calc( $findtok($1-,!done,1,32) -1) ] ] if ($findtok($1-,!done,1,32)) { done $gettok($ [ $+ [ $findtok($1-,!done,1,32) $+ - ] ],2-,32) } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $1 = max alias -l next { if ($1 !isnum) || ($1 <= 1) { tokenize 32 1 $2- } ; loop through regulars, save in var, sort them, keep the lowest var %x = $nick($chan,0,r), %n while (%x) { if ($wildtok($ial($nick($chan,%x,r)).mark,$+(next-,$hash($chan,32),-*),1,32)) { var %n = $sorttok($addtok(%n,$+($gettok($wildtok($ial($nick($chan,%x,r)).mark,$+(next-,$hash($chan,32),-*),1,32),-1,45),.,%x),32),32,n) var %n = $gettok(%n,1-18,32) } dec %x } ; loop trough the tokens, voice the user, send a notice and a messsage if needed var %x = 1, %y while (%x <= $numtok(%n,32)) && (%x <= $1) { pushmode $chan +v $nick($chan,$gettok($gettok(%n,%x,32),2,46),r) var %y = $addtok(%y,$nick($chan,$gettok($gettok(%n,%x,32),2,46),r),32) inc %x } if (%y) { .timer 1 2 !msg $chan %y $+ ; please state your question .notice $replace(%y,$chr(32),$chr(44)) You are now being voiced, please state your question } ; no users to voice, send notice else { cnotice $nick $chan NO users in queue } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CONNECT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:connect:{ ; check setting and start timer if ($next.adelay isnum) { .timer $+ $cid $+ .next.announce 1 $next.adelay next.announce } ; check setting and start timer if ($next.rdelay isnum) { .timer $+ $cid $+ .next.report 1 $next.rdelay next.report } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; JOIN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on !*:join:#:{ ; check chan, check ial, user isnt in the queue, add user if ($chan == $next.chan) && ($ial) && (!$wildtok($ial($nick).mark,$+(next-,$hash($next.chan,32),-*),1,32)) { .ialmark $nick $ial($nick).mark $+(next-,$hash($chan,32),-,$ctime) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OP EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:op:#:{ ; check chan, check ial, remove from queue if ($chan == $next.chan) && ($ial($opnick)) { .ialmark $opnick $remove($ial($opnick).mark,$wildtok($ial($opnick).mark,$+(next-,$hash($chan,32),-*),1,32)) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VOICE EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:voice:#:{ ; check chan, check ial, remove from queue if ($chan == $next.chan) && ($ial($vnick)) { .ialmark $vnick $remove($ial($vnick).mark,$wildtok($ial($vnick).mark,$+(next-,$hash($chan,32),-*),1,32)) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HELP EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:help:#:{ ; check chan, check ial, remove from queue if ($chan == $next.chan) && ($ial($hnick)) { .ialmark $hnick $remove($ial($hnick).mark,$wildtok($ial($hnick).mark,$+(next-,$hash($chan,32),-*),1,32)) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; KICK EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:kick:#:{ ; check chan, check ial, check other shared channels, not me kicked, remove from queue if ($chan == $next.chan) && ($ial($knick)) && ($comchan($knick,0) > 1) && ($knick != $me) { .ialmark $knick $remove($ial($knick).mark,$wildtok($ial($knick).mark,$+(next-,$hash($chan,32),-*),1,32)) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PART EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on *:part:#:{ ; check chan, check ial, check other shared channels if ($chan == $next.chan) && ($ial($nick)) && ($comchan($nick,0) > 1) { .ialmark $nick $remove($ial($nick).mark,$wildtok($ial($nick).mark,$+(next-,$hash($chan,32),-*),1,32)) } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUEUEME OPEN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:open:?:queueme:{ queueme } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; QUEUEME TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:text:queueme:?:{ queueme } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS QUEUEME ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l queueme { ; check chan, not in the queue, add to queue if ($nick isreg $next.chan) && (!$wildtok($ial($nick).mark,$+(next-,$hash($next.chan,32),-*),1,32)) { .ialmark $nick $ial($nick).mark $+(next-,$hash($next.chan,32),-,$ctime) } haltdef } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REMOVEME OPEN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:open:?:removeme:{ removeme } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; REMOVEME TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:text:removeme:?:{ removeme } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS REMOVEME ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l removeme { ; check chan, in queue, remove from queue if ($nick isreg $next.chan) && ($wildtok($ial($nick).mark,$+(next-,$hash($next.chan,32),-*),1,32)) { .ialmark $nick $remove($ial($nick).mark,$wildtok($ial($nick).mark,$+(next-,$hash($next.chan,32),-*),1,32)) } ; check chan, nick not opped or halfopped, devoice if ($nick isvoice $next.chan) && ($nick !isop $next.chan) && ($nick !ishop $next.chan) { pushmode $next.chan -v $nick } haltdef } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.STATUS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.status { ; loop to find all users in the queue var %x = $nick($1,0,r), %y = 0 while (%x) { if ($wildtok($ial($nick($1,%x,r)).mark,$+(next-,$hash($1,32),-*),1,32)) { inc %y } dec %x } return %y } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.REPORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.report { ; me is op or halfop, send wallchops (notice to chanops), start timer if ($me isop $next.chan) || ($me ishop $next.chan) { var %q = $next.status($next.chan), %n = $nick($next.chan,0,v,oh) .raw wallchops $next.chan :Queue status: $iif(%q == 1,%q user,%q users) queued, $iif(%n == 1,%n user,%n users) being helped } if ($next.rdelay isnum) { .timer $+ $cid $+ .next.report 1 $next.rdelay next.report } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS NEXT.REPORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; alias -l next.announce { ; me is op or halfop, send wallchops (notice to chanops), start timer if ($me isop $next.chan) || ($me ishop $next.chan) { msg $next.chan User queue is ON. Users are added to the queue on join. Users already in the channel can add themselves with "/MSG $me QUEUEME". To remove yourself at anytime use "/MSG $me REMOVEME". } if ($next.adelay isnum) { .timer $+ $cid $+ .next.announce 1 $next.adelay next.announce } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END GROEP #NEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #next end