Advertisement
Ford

Random quote script for mIRC

Oct 16th, 2012
1,181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.38 KB | None | 0 0
  1. ;Random Quote Bot Script by Ford_Lawnmower irc.Geekshed.net #Script-Help
  2. menu Channel,Status {
  3.   .$iif($group(#Quote) == On,$style(1)) Quote Trigger
  4.   ..$iif($group(#Quote) == On,$style(2)) On: .enable #Quote
  5.   ..$iif($group(#Quote) == Off,$style(2)) Off: .disable #Quote
  6. }
  7. #Quote on
  8. On $*:Text:/^(!|@)Quote/Si:#: {
  9.   if ($timer($+(Quote,$network,$nick))) { return }
  10.   .timer $+ $+(Quote,$network,$nick) 1 6 noop
  11.   var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
  12.   Quote %method $2-
  13. }
  14. #Quote end
  15. alias EchoQuote { Quote echo -a $1- }
  16. alias -l Quote {
  17.   $1-2 Searching for your Quote. Please wait........
  18.   var %sockname $+(Quote,$network,$2,$ticks)
  19.   sockopen %sockname www.quotedb.com 80
  20.   sockmark %sockname $1-2 /quote/quote.php?action=random_quote&=&=&
  21. }
  22. On *:sockopen:Quote*: {
  23.   if (!$sockerr) {
  24.     sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
  25.     sockwrite -n $sockname Host: www.quotedb.com
  26.     sockwrite -n $sockname $crlf
  27.   }
  28.   else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  29. }
  30. On *:sockread:Quote*: {
  31.   if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  32.   else {
  33.     var %Quote | sockread %Quote
  34.     if ($regex(%Quote,/document\.write\('(.*)<br>/i))) { sockmark $sockname $addtok($sock($sockname).mark,$regml(1),32)  }
  35.     if ($regex(%Quote,/<a\shref="http.*">(.*)<\/a>/i)) {
  36.       put $gettok($sock($sockname).mark,1-2,32) $+(07,$gettok($sock($sockname).mark,4-,32)) by04 $regml(1)
  37.       sockclose $sockname
  38.       return
  39.     }
  40.   }
  41. }
  42. alias -l Put {
  43.   if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text  | return }
  44.   tokenize 32 $regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t))
  45.   var %tokens $0, %Tstart 3, %Dtimer 1500
  46.   if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }  
  47.   while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
  48.     dec %tokens
  49.     if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
  50.       .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  51.       inc %Dtimer 1500
  52.       %Tstart = $calc(%tokens + 1)
  53.       %tokens = $0
  54.     }
  55.   }
  56.   .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  57.   .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement