mIRC Home    About    Download    Register    News    Help

Print Thread
S
svl3p
svl3p
S
hey..

want to make a quote feature on the bot i'm making...so ppl can add quotes, retrieve random quotes, and retrieve specific quotes by number...

if anyone can help, i'd really appreciate it...thx a lot

D
dreak
dreak
D
Do you mean like this?

Code:
on *:text:!aquote*:#:{
  if ($2) { write quotes.txt $2- | msg # $+(",$2-,") added to the quote database }
}

on *:text:!rquote*:#:{
  if (!$2) { 
    ;read a random quote
    var %q = $read(quotes.txt)
  }
  else {
    ;read the line specified
    var %q = $read(quotes.txt,$2)
    if (!%q) {
      ;No quote on that line so get a random one
      var %q = $read(quotes.txt)
    }
  }
  /msg # %q
}


!aquote <quote>
!rquote [number]

I havn't scripted mIRC for a while so there's probably a better way to do it though.

S
svl3p
svl3p
S
Thank You!

just what i needed smile

Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
On a side note, please remember not everyone will build an on the fly script for those who need help, some people would like to see an attempt at the script, to show an understanding amongst other things, hehe..

You could have even said "I know I'd need an an On Text event and add a trigger for the system. Luckily for you dreak is not one of those people who expects an attempt. smile

If you are very new to mIRC then I apologise, you wouldn't know what events mIRC have etc..

Whilst on the subject, if you do a search you may find some impeccable Quote Systems, more fully advanced than the one dreak appended above, but his/her(s) seems to be what you needed.

All the best,

-Andy

S
svl3p
svl3p
S
Sorry

I had tried to do it myself, but really didn't know what had to all be included in it, so got no where...I looked through all the topics in this thread, in case someone else had posted the same question, or something that would help, but didn't find anything, unless i missed it...

i knew i had to make a txt file for the quotes to go to, a trigger, and a text event..i just didn't know how to connect them...I'm still new to scripting

Sav

Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
It's imperitive for good search results you expand the date range to atleast 5 years. Indeed, someone has asked for what you want this year, but alot more people in 5 years, hehe. Here's some examples. smile

All the best,

-Andy

Joined: Sep 2004
Posts: 200
I
Fjord artisan
Offline
Fjord artisan
I
Joined: Sep 2004
Posts: 200
on *:text:!*quote*:#: {
if ($1 == !addquote) {
if ($2 == $null) { .notice $nick !addquote: invalid parameters: Invalid quote. }
else {
write quote.txt $ctime $nick $1-
msg $chan Quote $eval(#,0) $+ $lines(quote.txt) has been added.
}
}
if ($1 == !delquote) {
if ($nick isvoice $chan) || ($nick isop $chan) || ($nick ishop $chan) {
if ($2 == $null) { .notice $nick !delquote: invalid parameters: Invalid quote number. }
else {
if ($read(quote.txt,n,$2) == $null) { .notice $nick Quote $eval(#,0) $+ $2 does not exist. }
else {
write -dl $+ $2 quote.txt
msg $chan Quote $eval(#,0) $+ $2 has been deleted.
}
}
}
if ($1 == quote) {
if ($2 == help) {
.notice $nick Avaliable quote related commands are: !quote [number|null|help],!addquote <quote>,!delquote <number>.
}
elseif ($2 == null) || ($2 == $null) {
if ($read(quote.txt,n) == $null) {
.notice $nick There are no quotes!
}
else {
var %quote = $read(quote.txt,n)
var %time = $duration($calc($ctime - $gettok(%quote,1,32)))
var %auth = $gettok(%quote,2,32)
var %quote = $gettok(%quote,3-,32)
msg $chan Quote $eval(#,0) $+ $readn $+ , added: %time ago $+ , by %auth $+ : %quote
}
}
elseif ($2 isnum) {
if ($read(quote.txt,n,$2) == $null) { .notice $nick Quote $eval(#,0) $+ $2 does not exist, i only have $lines(quote.txt) Quotes in my database. }
else {
if ($read(quote.txt,n) == $null) {
.notice $nick There are no quotes!
}
else {
var %quote = $read(quote.txt,n,$2)
var %time = $duration($calc($ctime - $gettok(%quote,1,32)))
var %auth = $gettok(%quote,2,32)
var %quote = $gettok(%quote,3-,32)
msg $chan Quote $eval(#,0) $+ $readn $+ , added: %time ago $+ , by %auth $+ : %quote
}
}
}


smile if you find any bugs ill fix them i made it on the fly


Link Copied to Clipboard