on *:INPUT:*: { if ($readini($mircini,text,commandchar) == $left($1,1)) { return } | if ($inpaste) && (5 < $cb(0)) && ($active ischan) { writecb | playcb | halt } }
alias writecb {
var %a = 2, %b = $cb(0)
while (%a <= %b) {
write clipboard.tmp $cb(%a)
inc %a
}
}
alias playcb {
var %delay = 3000 | set %pastechan $active
.play clipboard.tmp %delay
echo $color(info2) -t %pastechan * Pasting $calc($play($active).lines +1) lines to $active with %delay $+ ms delay
msg $active $cb(1)
}
on *:PLAYEND: { if ($gettok($filename,-1,$asc(\)) == clipboard.tmp) { echo $color(info2) -t %pastechan * Pasting finished | .remove clipboard.tmp | unset %pastechan } }
My problem is when I copy something into a channel nothing happens, but when i remove
(5 < $cb(0)) from the code I get this:
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
[13:03:11] <nick> mytext
* /play: unable to open '...' (line ..., ....ini)
So what's wrong with my script?