Random Quote Bot Script

By FordLawnmower on Dec 20, 2009

Requested by yna.
Basically a mIRC version of the TCL script I posted.
Triggers are:
!Quote - Will notice the user.
@Quote - Will message the channel if the user has HalfOps or higher.
/EchoQuote - Must be typed from the client that has the script loaded and will echo back to the active screen.

To use this script: Load into Remotes,Right click Channel or Status Window and turn the Quote Trigger On.

Example Output:
13:30:26 <RiverChigger> Searching for your Quote. Please wait........
13:30:29 <RiverChigger> If I ever get real rich I hope I`m not real mean to poor people like I am now. y Jack Handey

;Random Quote Bot Script by Ford_Lawnmower irc.Geekshed.net #Script-Help
menu Channel,Status {
  .$iif($group(#Quote) == On,$style(1)) Quote Trigger
  ..$iif($group(#Quote) == On,$style(2)) On: .enable #Quote
  ..$iif($group(#Quote) == Off,$style(2)) Off: .disable #Quote
#Quote on
On $*:Text:/^(!|@)Quote/Si:#: {
  if ($timer($+(Quote,$network,$nick))) { return }
  .timer $+ $+(Quote,$network,$nick) 1 6 noop
  var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
  Quote %method $2-
#Quote end
alias EchoQuote { Quote echo -a $1- }
alias -l Quote {
  $1-2 Searching for your Quote. Please wait........
  var %sockname $+(Quote,$network,$2,$ticks)
  sockopen %sockname www.quotedb.com 80
  sockmark %sockname $1-2 /quote/quote.php?action=random_quote&=&=&
On *:sockopen:Quote*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
    sockwrite -n $sockname Host: www.quotedb.com
    sockwrite -n $sockname $crlf
  else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
On *:sockread:Quote*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %Quote | sockread %Quote
    if ($regex(%Quote,/document\.write\('(.*)<br>/i))) { sockmark $sockname $addtok($sock($sockname).mark,$regml(1),32)  }
    if ($regex(%Quote,/<a\shref="http.*">(.*)<\/a>/i)) {
      put $gettok($sock($sockname).mark,1-2,32) $+(07,$gettok($sock($sockname).mark,4-,32)) by04 $regml(1)
      sockclose $sockname
alias -l Put {
  if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text  | return }
  tokenize 32 $regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t))
  var %tokens $0, %Tstart 3, %Dtimer 1500
  if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }  
  while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
    dec %tokens
    if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
      .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
      inc %Dtimer 1500
      %Tstart = $calc(%tokens + 1)
      %tokens = $0
  .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop 


Sign in to comment.
cptpan   -  Oct 24, 2013

So this is totally broken now?

Stewie1k94   -  Oct 17, 2012

[8:47am] <~Stewie> @Quote
[8:47am] <&thunderbolt> Searching for your Quote. Please wait........
[8:47am] <&thunderbolt> I don`t believe in quotas. America was founded on a philosophy of individual rights, not group rights. by Clarence Thomas Thank you. :)

FordLawnmower   -  Oct 16, 2012

It's not going to work from here ;/
The site is removing the
tag from the code.
It will work if you get the code from here: http://pastebin.com/1JursB8e

Stewie1k94   -  Oct 16, 2012

I did try it, and it didn't work. Would be a nice addition to my bot though! > [12:17am] <~Stewie> @quote
[12:17am] <&thunderbolt> Searching for your Quote. Please wait........ and that's all I got.,,,

FordLawnmower   -  Oct 16, 2012

It doesn't toclafane1 . It was probably some old debug code. Thanks for noticing. I'll have a look at this script and see if it even still works.

Stewie1k94   -  Oct 16, 2012

Why does it need the

| echo -gat here


RIcko   -  Jun 26, 2012

Thanks <3

and if you have the time then you can remove these
/ thingies in the results:

(Jun-Wed-27)(1:10:32:pm) <05&Pyro> Trouble shared is trouble halved.
'); More quotes from Dorothy Sayers'); by04 Dorothy Sayers

FordLawnmower   -  Jun 26, 2012

This script was broken: Updated

RIcko   -  Jun 26, 2012

Good snippet, but noone could use it now because it needs an update
Searching for your Quote. Please wait........

then nothing appears

LonesomeRanger   -  Jan 08, 2012

I had to upgrade my mIRC anyways, so I took the drastic step to upgrade it to the latest... 7.22
I now use FordLawnmowers Pandora bot script, and it works perfectly, without any problems
However... I might go test-drive this script anyway and drop the Pandora one, simply because those bots are a bit too 'present' and too 'loud' to my liking...

@FordLawnmower... Thanks man, for your efforts to provide us simple 'users' the possibility of using those handy and nifty scripts! Even just reading the comment section on your Pandora script is worth the time! Soooo funny! ;)
@blackvenomm666... Thanks for the help! ...and kind offer!

blackvenomm666   -  Jan 06, 2012

i use 6.32 and it runs all of ford's scripts fine when i test em. sooo if you don't wanna upgrade too much lonesomeranger try 6.32 but 6.35 works great too i've got that one somewhere

FordLawnmower   -  Jan 06, 2012

6.16 is almost 9 years old. I would suggest an upgrade to at least 6.35

LonesomeRanger   -  Jan 06, 2012

My bot uses mIRC 6.12
but after replacing it with 6.16 the problem persists unchanged!

FordLawnmower   -  Jan 06, 2012

@LonesomeRanger If you don't have /noop command then your mIRC is probably very old.
What is your mIRC version ?

LonesomeRanger   -  Jan 05, 2012

Loaded the code in my bots remotes, turned it on in the channel richt-click menu.
Triggered it in the channel, using ' !quote ' and just like expected it returned a notice:

Searching for your Quote. Please wait........
but the second line, the quote itself did not come!
In the bots statuswindow it said:

* /timer: timer 1 not active
NOOP Unknown command
NOOP Unknown command

I wonder what it could be!
Did i do something wrong, or does this script need updating?
Can anyone help me with this?

Jethro   -  Dec 24, 2009

Yup, don't you just love the "Bill of Rights?" lol Again, your effort is greater than the score has to offer. Don't ever underestimate that.

FordLawnmower   -  Dec 22, 2009

Thanks for all the kind comments everyone.
I'm very happy to be a part of the Hawkee community.

I totally understand that it is the same freedom that gives someone the right to rate scripts with a 1 that makes this site such a wonderful place.

There is no way that I would trade that freedom for a higher score :)

SnoooP   -  Dec 22, 2009

Ford whoever is doing that is just an asshole. Don't be bothered by the rating mate your work is awesome. We know it, more importantly you know it. Keep up the good work mate :)

JDavis   -  Dec 22, 2009

i bumped it up alittle with a 10/10 ford.. ^^

Jethro   -  Dec 22, 2009

That's very, very ignorant of them to engage in such behavior. But don't sweat over it, Fordlawnmower, the score is only a number; what really matters is you make a GREAT, respectable script, and that's what counts! You will always have my support. Keep up the good work. Let those rascals play with the "rate" tab and see how boring they can get.

Silo   -  Dec 22, 2009

But why would ppl do that? Sorry to seem naive, but if I see a good, well executed script I love to give it props. Let's face it, the differences between a quality script and a crappy script is very obvious.

Anyway, man, don't worry about it. You know you do good work and the people that matter know also.

FordLawnmower   -  Dec 21, 2009

Yea, I noticed that too Aucun50. Someone who goes around rating working scripts with 1's should lose the right to rate. I've had someone give almost all of my scripts a 1.
I find it very childish and cowardly to say the least.

Aucun50   -  Dec 21, 2009

I like how the score went from 8.3 to 6.9 and there is only good comments.

Master-Of-Death   -  Dec 21, 2009

Great Job, this script just made me remember how much of a n00b i am lol, 10/10

JDavis   -  Dec 21, 2009


Silo   -  Dec 20, 2009

8/10 Nice, clean looking code as usual.

FordLawnmower   -  Dec 20, 2009

Thank You Aucun50 :)

Aucun50   -  Dec 20, 2009

Yup another great use of regex and sockets :)

FordLawnmower   -  Dec 20, 2009

Thanks SnoooP

SnoooP   -  Dec 20, 2009

As usual a nice script, good work.

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.