Paste Delayer

By pball on Oct 17, 2011

This script allows for a delay to be added in between pasted lines, which is great for posting lots of lines and not getting kicked or killed for spamming.

Usage:
After you load the script it will not be on. You have to add the delay time in milliseconds. 1000 ms is 1 second.

Type: /pastedelay 250
This will give you a delay time of 1/4 second between lines. Entering 0 will turn the script off.

There is also a command to stop the current paste if you accidental paste something really long or just want to stop it.

Type: /stoppaste

Warning:
This script may not work on a client with a theme script, as theme scripting can hijack the on input to add the theme. Which could either cause it to not work or display/send the text twice.

Authors rant:
I made this script many months ago but it had one little bug i just picked up on a few days ago. It wouldn't display text in the edit box when multiple lines were pasted. So I just spent a longer time than I'd like to admit fixing the problem. Not only was the problem fixed but the script is much simpler now.
/rant

/*
[Addon]
Script=Paste Delayer
Version=3.0
Author=pball
Desc=Add a delay time between pasted lines and the ability to stop pasting. Type /stoppaste while a paste is being pasted to stop the pasting. Type /pastedelay <number> to set the paste delay, number must be in milliseconds 1000ms = 1sec. Setting the delay to 0 turns off the script.
For=Mirc
Date=10-17-11

[script]
*/
on *:input:*:{
  if ($inpaste) && (%cbpdt) && ($cb(0) > 1) {
    set -l %num 1
    while ($timer($+(cb,%num))) inc %num
    .timercb $+ %num -m 1 $calc((%num * %cbpdt) - %cbpdt) pdf $encode(msg $iif($chan,$v1,$target) $1-,m)
    halt
  }
}
alias stoppaste { .timercb* off | echo -a Paste stopped }
alias pastedelay { if ($1 isnum) { set %cbpdt $1 | echo -a $iif($1 == 0,07 $+ $chr(44) $+ 01Paste delay off [delay 0],07 $+ $chr(44) $+ 01Paste delay changed to $1 $+ ms) } }
alias -l pdf { $decode($1-,m) }

Comments

Sign in to comment.
pball   -  Oct 17, 2011

I guess that's a way to do it. I personally like staying away from files for quick things and I've just never used play for anything really.

Important note to remember if you dealing with on input and pasted text. If there is text in the edit box when you paste multiple lines, $1- in the on input will have the original text and the pasted text. That was a minor bug I fixed with this, since by default if you have text in the edit box and paste multiple lines that text appears in front of the first pasted line.

 Respond  
Jethro   -  Oct 17, 2011

Very good work. I know one way without using the timer is the play command, which you can write all the copied lines and identifiers to a file and then play it to the channel with the -c switch and a desired delay adjustment. Then write -c it to start anew. To stop the current paste with play command, it's handy to just use /play stop.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.