Quote Script

By Vegito on Oct 13, 2013

Syntax:
!qadd quote to add a quote.
!qdel nr nr nr to delete a quote.
!quote [num] to read specified quote, if [num] is not specified it will return a random quote.
!qotd to see the quote of the day.
!qsearch term to get position N of quotes with the specified term.
!qsearch [-a] author to get nr of quotes by author.
!qlines returns N quotes are added.
!qopen to open the quote file.

!atime[minutes] to set duration of auto read quote in minutes.
!aquote[on/off] to turn auto quote on or off.

!ftime [minutes] to set duration of floodcheck in minutes.
!fcheck [on/off] to turn floodcheck on or off.

Examples:

Image

Image

Image

on *:LOAD: set %owner $input(Enter name of the bot owner:,e) 
#fcheck on
alias -l fcheck {
  if ($regex($1,/(quote|qotd|qsearch)$/Si)) {
    if ($prop = add) set -z $+(%,$regml(1),$site,$network) %fMins
    else return $+(%,$regml(1),$site,$network)
  }
}
#fcheck end

alias -l up return $+($upper($left($1,1)),$mid($1,2)) 

on *:text:*:#: {
  var %file quote.txt, %x $lines(%file), %y $read(%file, n, $2), %rx $r(1,$lines(%file)), %ry $read(%file, n, %rx)
  if (!%x && $regex($1,/^!q(del|uote|otd|search|lines|open)$/Si)) { notice $nick 12There does not appear to be any quotes added yet. | halt }
  if ($1 = !qadd) {
    if ($nick !isop # && $v1 != %owner) { notice $v1 12You need to be a operator in # $+ . | halt }
    if (!$2) { notice $nick 12Syntax: $1 4[quote] | halt }
    tokenize 58 $2- | write %file $+(,$up($1),$chr(58),) $qt($up($2)) | var %x $lines(%file) | notice $nick 12Added quote at 4position %x
  }
  if ($1 = !qdel) {
    if ($nick != %owner) { notice $v1 12Ask $v2 to delete a quote. | halt }
    if (!$2) { notice $nick 12Syntax: $1 4[1 - %x $+ ] | halt }
    var %i $numtok($2-, 32)
    while (%i) { var %list $sorttok($addtok(%list,$gettok($sorttok($2-, 32, n),%i,32),32),32,n) | dec %i }
    var %j $numtok(%list, 32) 
    while (%j) { 
      if (!$read(%file, n, $gettok(%list,%j,32))) notice $nick 12Quote 4# $+ $gettok(%list,%j,32) 12Does not exist 4You can select 1 to %x 
      else { 
        notice $nick 12Quote 04# $+ $gettok(%list,%j,32) 12has been removed.
        write -dl $gettok(%list,%j,32) %file 
      }  
      dec %j 
    }
  }  
  if ($1 = !quote) {
    if ($2 && $2 !isnum) { notice $nick 12Syntax: $1 4[1 - %x $+ ] | halt }
    if ($2 && !%y || $2 < 0) { notice $nick 12Quote 4# $+ $2 12Does not exist 4You can select 1 to %x | halt }
    if ($($fcheck($right($1, -1)),2)) { notice $nick 12You must wait04 $duration($v1) 12before you can use that again. | halt }
    $fcheck($right($1, -1)).add
    if (!$2) { msg # 12Random Quote 4# $+ %rx 12- %ry | halt }
    msg # 12Quote 4# $+ $2 12- %y
  }
  if ($1 = !qotd) {
    if (%date != $date) var -g %date $v2, %qotd %rx
    if ($($fcheck($right($1, -1)),2)) { notice $nick 12You must wait04 $duration($v1) 12before you can use that again. | halt }
    $fcheck($right($1, -1)).add | msg # 10Quote of the the Day: 12 $+ $read(%file, n, %qotd) 
  }
  if ($1 = !qsearch) {
    if ($($fcheck($right($1, -1)),2)) { notice $nick 12You must wait04 $duration($v1) 12before you can use that again. | halt }
    $fcheck($right($1, -1)).add
    if (!$2) { notice $nick 12Syntax: 4 $+ $1 [term] | halt }
    var %i 1 | while ($read(%file,n,%i)) {
      if ($2 = -a) {
        if (!$3) { notice $nick 12Syntax: 4 $+ $1-2 [author] | halt }
        var %author $gettok($read(%file,n,%i),1,2)
        if ($3- $+ : = $strip(%author,b)) var %qsearch $addtok(%qsearch,%i,32) 
      }  
      elseif ($2- isin $read(%file,n,%i)) var %qsearch $addtok(%qsearch,%i,32) 
      inc %i
    }
    if (!%qsearch) notice $nick 12There is no quote matching $+(4,$iif($2 = -a,$3-,$2),.) 
    else notice $nick 12Matching quotes for $+(04,$iif($2 = -a,$3-,$2-),: 10,%qsearch,)
  }
  if ($1 = !aquote && $regex($2,/^o(|n|ff)$/Si) && $nick = %owner) {
    if (!%aMins) { notice $nick 12You have first to set the duration of aQuote. | notice $nick 12Syntax: 4!aTime [mins] | halt }
    if ($regml(1) = n) { msg # 12aQuote has been activated. | timerAQuote 0 %aMins msg # 13Auto Quote: 12 $!read( %file , n) }
    elseif ($timer(AQuote)) { timerAQuote $2 | msg # 12 $+ aQuote has been turned off. }
  }
  if ($1 = !qlines) notice $nick 12There are 04 $+ %x quotes 12added.
  if ($1 = !qopen && $nick = %owner) run %file
  if ($regex($1,/^!(a|f)time$/Si) && $nick = %owner) {
    if ($2 isnum && $2 >= 0) {
      set $+(%,$regml(1),Mins $calc($int($2) * 60 + $gettok($2,2,46)))
      msg # 12Setted duration of $iif($regml(1) = a,aQuote,floodcheck) to $2 minutes.  
    }
  }
  if ($1 = !fcheck && $regex($2,/^o(|n|ff)$/Si) && $nick = %owner) {
    if (!%fMins) { notice $nick 12You have first to set the duration of fTime. | notice $nick 12Syntax: 4!fTime [mins] | halt }
    $iif($regml(1) = n,en,dis) $+ able #fcheck
    msg # 12Floodcheck has been $iif($v1 = $v2,en,dis) $+ abled.   
  }
}

Comments

Sign in to comment.
dma   -  Aug 31, 2016

how do i delete a quote ? i tryed what you said and it dont work

Vegito  -  Sep 04, 2016

What do you mean? It works fine for me. What happens, when you try to delete a quote?

dma  -  Sep 05, 2016

it does nothing

Vegito  -  Sep 17, 2016

I'm not really active here, I hardly check Hawkee anymore., if you want help I'm at Server: irc.lunarirc.net Channel: #LunarIRC

dma  -  Sep 18, 2016

oh ok ty any way

Sign in to comment

dma   -  Jun 15, 2016

I got a big qyesstion.... how do I to start it so i can read older quotes i tried everything listed PLEASR

 Respond  
Arsalan123   -  May 12, 2016

Hey Fellas i have a question
How can i Copy a text and send it to someone else ??
for Example :
X : Hello Brother
and then bot Copy "Hello Brother" and send it to Y

 Respond  
dma   -  Dec 08, 2015

last night and a few days ago this was not working ,, thanks for the update I guess

Vegito  -  Dec 29, 2015

I didn't update it.

dma  -  Apr 23, 2016

how do you really del a quote that method didn't work for me... HALP!

Sign in to comment

cptpan   -  Sep 10, 2014

If the quotes are links it just fucks up.

[15:18] Random Quote #1 - " http"

 Respond  
Blaze147   -  May 25, 2014

Can anyone tell me why after this script none else works?

Vegito  -  May 26, 2014

What does not work?

Blaze147  -  May 26, 2014

Quote script works perfect, but other scripts does not work after it

Vegito  -  May 28, 2014

The other scripts ain't gonna work in the same file, add the quote script in new file.

  1. Press alt + r
  2. File > New
    example: http://i.imgur.com/xuTn0FP.png
  3. Paste the quote script.
  4. Go to File > Save as > Save it as quote.mrc
    example: http://i.imgur.com/yVO2p85.png
  5. click on ok
  6. Then you should see: http://i.imgur.com/B7S74i0.png
    Click on yes.
  7. Then this popup should appear: http://prntscr.com/2cju68
    Enter the botownersname don't enter bots name.
    click on ok
Blaze147  -  May 28, 2014

Is there a way to other scripts work with this one. Shame that i have to create 2 or more files

Vegito  -  May 30, 2014

There is a way to do that you would have to make seperate text events.

Blaze147  -  May 30, 2014

Can you tell me how?

cptpan  -  Jun 20, 2014

Just add your other scripts in different .mrc file and load them.

Sign in to comment

adlez231   -  Apr 10, 2014

I know this was months ago, but by any chance you see this, how do I implement this code? I am very new to mIRC and I am unsure of how to use it.

Vegito  -  Apr 11, 2014
  1. Start mIRC
  2. Press alt + r (This should open remote)
  3. copy this script and paste it in remote.
  4. press on ok
  5. You should see http://i.imgur.com/B7S74i0.png
    Click on yes.
  6. After that you should see http://prntscr.com/2cju68
    Enter the bot owners name NOT bots name.
  7. Use !qadd [quote here] to add quote. Example: http://i.imgur.com/TxPGlC9.png
  8. After that you can type !quote 1 or !quote for random quote.
adlez231  -  Apr 11, 2014

I've done that, but I get no popup. Is there a specific version of mIRC I should be using?

Vegito  -  Apr 11, 2014

You should unload and load the script.

adlez231  -  Apr 13, 2014

Thank you so much! It works now, but it's still doing weird things. It does not say when a quote is added, and it also puts weird numbers and quotes. It turns (!qadd "I really need to learn how to start breeding. It sounds like fun" - Alice [Pokemon]) into (12Random Quote 4#1 12- "I really need to learn how to start breeding. It sounds like fun" - Alice [Pokemon]: "")
Any insight on how to fix this? I know Java, but I can barely read mIRC at all.

adlez231  -  Apr 13, 2014

I should say that in the mIRC client, the quote shows up fine, but I am using the script on a bot for Twitch and that is where I'm having the issues.

adlez231  -  Apr 13, 2014

Also, I now see that in mIRC it also lists the "Command added", and all the other text, but I'd like that to be in the channel so people know when it is working correctly. I apologise for so much, but if you could even tell me how to fix it myself I'd appreciate it.

Vegito  -  Apr 15, 2014

Do you mean when you add a question? It should notice that you've added a question.

Sign in to comment

Laxus   -  Dec 19, 2013

http://prntscr.com/2chx0m doesn't work, I have owner permissions on the channel and it does not let me delete it.

Vegito  -  Dec 20, 2013

When you load the script you should see:

1st. http://i.imgur.com/B7S74i0.png
Click on yes.

2nd. http://prntscr.com/2cju68
Enter the botownersname don't enter bots name.
Then click on ok.

Then it should work fine.

Laxus  -  Dec 20, 2013

Oh, thanks.

Sign in to comment

m1ndl3ss   -  Oct 23, 2013

I am having trouble with what I think should be a simple script...I have a text file which contains one quote per line. I want to randomly read a quote once per hour in the channel I am an op for. Here is what I have;
on *:JOIN:#:{
/timergreet 0 3600 /msg $chan - Quote of the Day: $read(biqquotes.txt)
}
Where the problem is, it randomly selects one quote initially, but then will repeat the same quote it originally selected. How can I get it to randomly select a quote the 2nd and 3rd, etc time after the first selection?

Vegito  -  Oct 23, 2013

Do you want it to read a random quote everytime someone joins?
Quote of the day should change daily right?

m1ndl3ss  -  Oct 23, 2013

Yes, I figured it out... in the $read function, if you make it $!read it forces it to re-evaluate (in this case pick a new random line) every time. Woo Hoo!!!!

KilllerX  -  Oct 23, 2013

3600 is 3600 seconds, which translates to 60 minutes, translating to 1 hour. Do you just want a different message each join? Or different message each day?

.timerquote 86400 .set %dailyQuote $rand(0,$!lines(bigquotes.txt)) - this will read how many lines are in, and choose a random one from the 0th (first) line, and the last line in bigquotes.

Then you can do

msg # $read(bigquotes.txt, %dailyQuote)

I would have these sperate, as setting the greet, is requested upon someone joining.

Alias DailyQuote {
  set %dailyQuote $rand(0,$!lines(bigquotes.txt))
 .timerquote 86400 set %dailyQuote $rand(0,$!lines(bigquotes.txt))
} 

-this will set it upon use then every day (if you keep the bot running 24/7 will reset the daily quote.

ON !*:JOIN:*:{
 if (!%qotdFlood) {
 msg # Quote of the Day - $read(bigquotes.txt, %dailyQuote) | .inc %qotdFlood -z 60
 }
}

The .inc is for a flood protections so if 20 people join at once, it doesn't spam it. It can only be said, omn a join once a minute.

and so you know, inside the actual code. You don't need all the / and . Although infront of the timer to my knowledge makes the event 'silent' or that it won't post it. # is the same as $chan.

If you use this. and you put the Alias in your 'alias' file, MAke sure you don't have Alias, So I would put it in the remote with the Alias. Then on

KilllerX  -  Oct 23, 2013

To start the setting of it. You would have to type /DailyQuote in the bots talk bar. Oh, ok. You did say once an hour. So, yes 3600 is an hour. Use that instead of the 86400. And I would change the "Quote of the Day" to something more like "Quote of the Hour."

Vegito  -  Oct 23, 2013

For quote of the day
This works also if bot is not 24/7 online .

if ($1 = !qotd) {
  if (%date != $date) var -g %date $v2, %qotd %rx 
  msg # 10Quote of the the Day: 12 $+ $read(%file, n, %qotd) 
}
Sign in to comment

Jinn   -  Oct 19, 2013

Hey but..
[11:58] !qadd test - test
[11:58] mybot Added on line 37
[11:58] !quote 37
[11:58] Quote: 4#37 test: "-test"

What's wrong? I want it make a simple line like
!qadd test - test
!quote num
bot: Quote: test - test

Help please.

Farcrada  -  Oct 19, 2013

Are you using the one with or without timer?

Jinn  -  Oct 19, 2013

With timer.

Jinn  -  Oct 19, 2013

Btw, I want the Quotes("") to be removed.
It should simply output like:

The quote - quoter Sorry, I'm kinda new.
Vegito  -  Oct 19, 2013

Replace line 16 with:

write %file   $+ $up($2) $+ :  $qt($up($3-)) | var %x $lines(%file) | notice $nick 12Added quote at 4position %x

To get rid of quotation marks.

Jinn  -  Oct 21, 2013

So to remove the [ quoter: quote ] format and make it simply as [ quote - quoter ] ?

Thanks.

Vegito  -  Oct 22, 2013

Image

Do you want it like that?

Replace line 16 with:

write %file  $up($2) $3- | var %x $lines(%file) | notice $nick 12Added quote at 4position %x
Jinn  -  Oct 22, 2013

Right, the adding part is now working but the random quote part stopped working for me also the deleting part is kinda messed. Sent you a message please do check. Thanks.

Vegito  -  Oct 22, 2013

Random quote and delquote are working for me.

Sign in to comment

Jinn   -  Oct 18, 2013

Excellent...

 Respond  
Vegito   -  Oct 14, 2013

@Farcrada ok I added a timer.

 Respond  
Farcrada   -  Oct 14, 2013

:O Ohw! Maybe a spam/flood check thingy? Might be useful. Can use "goto"s or "inc"s... Idk, what ever you prefer.

 Respond  
Vegito   -  Oct 14, 2013

Ok I updated the code.

 Respond  
Farcrada   -  Oct 13, 2013

Why not thrash "!rquote" and make it so that when you not specify a number by "!quote" it gives a random quote?

 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.