Downloading File
Filename: /aflood - $aflood
; ------------------------------------------- ; /aflood v1.1 - $aflood by Flobse ; ; This snippet is an "Message-Buffer". ; You can add, delete and view messages to the queue which will be played by a defined speed in #channels or @windows ; ; ------------------------------------------- ; ; Syntax: ; ; /aflood <Name> <Target> <Message> - to add some messages ; /aflood -d <Name> - to remove some messages (wildcard *) ; /aflood stop - stops the queued messages (no delete) ; /aflood play - plays the queued messages ; $aflood(Name,N) - returns the Nth message from Name (wildcard *) ; $aflood(N) - returns the Nth message (0 returns number of contents) ; ; ------------------------------------------- ; ; Example: ; ; alias test { ; window @test ; var %x = 1 ; while (%x <= 10) { ; aflood Channelmsg #yxcasdqwe This message will be shown in #yxcasdqwe the %x $+ th time. ; aflood Windowecho @test This message will be shown in @test the %x $+ th time. (not timed) ; aflood Statusecho Status Window This message will be shown in the Status Window the %x $+ th time. (not timed) ; inc %x ; } ; } ; ; After /test are 30 (3x10) messages in the queue. ; If the target is an @window or the Status Window it will be echo directly without any timer. ; Only the messages to the #channel will be play timed (default 2 secs per line) ; ; Now u could stop the queue-play for example with /aflood -d * or /aflood -d Channelmsg or /aflood -d Channel* ; ; ------------------------------------------- alias aflood { var %timer 2000 if ($1 == 0) && ($isid) { return $hget(aflood,0).item } if ($1 isnum) && ($isid) { return $hget(aflood,$hfind(aflood,*,$1,w)) } if ($2 == 0) && ($isid) { var %x 1 | while ($hfind(aflood,/^ $+ $replace($1,*,.*?) $+ \b/i,%x,r).data) { inc %x } return $calc(%x -1) } if ($2 isnum) && ($isid) { return $hget(aflood,$hfind(aflood,/^ $+ $replace($1,*,.*?) $+ \b/i,$2,r).data) } if ($1 == -d) && ($2 != $null) { while ($hfind(aflood,/^ $+ $replace($2,*,.*?) $+ \b/i,1,r).data) { hdel aflood $v1 } } elseif ($1 == stop) { .timeraflood off } elseif ($1 == play) { .timeraflood -m 1 %timer aflood.queue } else { if ($1 isnum) { echo -s */aflood error: "Name" cant be a number. } if ($2-3 == Status Window) || ($left($2,1) == @) { echo $iif($v1 == @,$2-,-s $4-) | return } hinc -m afloodc counter | hadd -m aflood $hget(afloodc,counter) $1- if (!$timer(aflood)) { aflood.queue | .timeraflood -m 1 %timer aflood.queue } } } alias -l aflood.queue { if ($hfind(aflood,*,1,w)) { var %h $v1 | tokenize 32 $hget(aflood,%h),2,32 if (($left($2,1) == $chr(35)) && ($me ison $2)) || ($left($2,1) != $chr(35)) && ($status == connected) { msg $2- | hdel aflood %h if ($hget(aflood,0).item) { aflood play } else { hfree aflood | hfree afloodc } } } } ;EoF