Advertisement
SReject

mIRC Throttle

Jan 20th, 2018
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.94 KB | None | 0 0
  1. ;; Use the following commands to throttle their
  2. ;; counterparts.
  3. ;; More can be added using the same format or
  4. ;; /throttle can be called directly using the
  5. ;; format of:
  6. ;;   /throttle cmd [params]
  7. alias tmsg      throttle msg $1-
  8. alias tdescribe throttle describe $1-
  9. alias tnotice   throttle notice $1-
  10.  
  11. ;; Workhorse; handles queueing and execution
  12. ;; throttled commanded
  13. alias throttle {
  14.  
  15.   ;; Throttle id - used for connection-specified
  16.   ;; window and timer names
  17.   var %TID = $+(@Throttle, $cid)
  18.  
  19.   ;; If not connected close the throttle buffer
  20.   ;; window
  21.   if ($status !== connected) {
  22.     close -@ %TID
  23.   }
  24.  
  25.   ;; If the input is not meant as a throttle
  26.   ;; execution iteration
  27.   elseif ($1- !=== -r) {
  28.  
  29.     ;; if the throttle buffer window is not open,
  30.     ;; create it as a hidden & minimized list
  31.     ;; window
  32.     if (!$window(%TID)) {
  33.       window -lnh0 %TID
  34.     }
  35.  
  36.     ;; If the throttle-read timer is running,
  37.     ;; simply add the input command to the
  38.     ;; throttle buffer
  39.     if ($timer(%TID)) {
  40.       aline %TID $1-
  41.     }
  42.  
  43.     ;; Otherwise, its been longer than 2 seconds
  44.     ;; since a command has executed so execute
  45.     ;; the input command and start the timer to
  46.     ;; read the throttle buffer in 2 seconds
  47.     else {
  48.       $1-
  49.       $+(.timer,%TID) 1 2 throttle -r
  50.     }
  51.   }
  52.  
  53.   ;; if the input is meant as a throttle read and
  54.   ;; there is a throttled command to be executed,
  55.   ;; execute the command, remove it from the
  56.   ;; throttle buffer and start a timer to read
  57.   ;; from the buffer again in 2 seconds
  58.   elseif ($line(%TID, 1)) {
  59.     $v1
  60.     dline %TID 1
  61.     $+(.timer, %TID) 1 2 throttle -r
  62.   }
  63. }
  64.  
  65. ;; When an outbound message is sent reset the
  66. ;; throttle-read timer. This is done so non
  67. ;; throttle commands reset the read-delay of
  68. ;; throttled commands
  69. on *:PARSELINE:out:*:{
  70.   var %tid = $+(@Throttle, $cid)
  71.   if ($timer(%tid)) {
  72.     $+(.timer, %tid) 1 2 throttle -r
  73.   }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement