This alias will find all bans matching whatever you search for, for example;
/sb *.net would search for all addresses on the ban list ending with .net and return them in the channel.
The newer version, which will be released in a few weeks (busy) will contain a dialog.
alias sb {
if ($active !ischan) {
echo 4 $active Error: You are not on a channel.
}
if (!$1) {
echo 4 $active $+(4Banlist Size,$chr(32),$chr(40),$ibl($active,0),$chr(41))
halt
}
var %i = $1
var %d = $ibl($active,0)
var %o = 1
while (%o <= %d) {
if (%i iswm $ibl($active,%o)) {
write wmsb.txt $+(4,[,$iif($lines(wmsb.txt) < 1, 1, $calc($lines(wmsb.txt) +1)),],) Matched string $+(,$chr(40),$1,$chr(41),) - $ibl($active,%o)
}
inc %o
}
echo 4 $+(4,$lines(wmsb.txt)) results found for string $+(%i,.)
.play -e wmsb.txt
.write -c wmsb.txt
}
if ($chr(35) !isin $active) {
echo 4 $active Error: No are not on a channel.
}
Use:
if ($active !ischan) {
also,
echo -a, instead of echo $active.
also:
you dont need the \"halt\" here:
if (!$1) {
echo 4 $active $+(4Banlist Size,$chr(32),$chr(40),$ibl($active,0),$chr(41))
halt
}
this is what you use:
var %i = $1
var %d = $ibl($active,0)
var %o = 1
while (%o <= %d) {
if (%i iswm $ibl($active,%o)) {
write wmsb.txt $+(4,[,$iif($lines(wmsb.txt) < 1, 1, $calc($lines(wmsb.txt) +1)),],) Matched string $+(,$chr(40),$1,$chr(41),) - $ibl($active,%o)
}
inc %o
}
echo 4 $+(4,$lines(wmsb.txt)) results found for string $+(%i,.)
.play -e wmsb.txt
.write -c wmsb.txt
}
I would use:
alias sb {
if ($active !ischan) { echo -a Error: No are not on a channel. | return }
if (!$1) { echo -a $+(4Banlist Size,$chr(32),$chr(40),$ibl($active,0),$chr(41)) | return }
; Using proper if format for the IF\'s above.
updatenl
; update the ban list
var %i = $1, %d = $ibl($active,0), %o = 1, %x, %y = $active
; using 1 line for all temp. vars.
while (%o <= %d) {
if (%i iswm $ibl($active,%o)) {
%x = %x $v2
var %a = $ibl(%y,%o).by, %b = $asctime($ibl(%y,%o).ctime)
; Set the values for the result
}
inc %o
}
echo -a $numtok(%x,32) results found for string $qt(%i)
; $numtok() shows how many tokens %x contains.
if ($numtok(%x,32) != 0) echo -a %x matched %i set by %a at %b
; checks to $numtok is not 0.
}
Note that my code above is untested, but it should do what you want, without using the text file.
Your script resulted * /play: unable to open \'C:\Regularmirc\wmsb.txt\' (line 58, script.ini) when no matches were found. Anyhow, this script above you be fine. No color codes though ;p