mIRC Home    About    Download    Register    News    Help

Print Thread
#230712 18/03/11 07:02 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
A friend gave me this script where you can add quotes and it's really nice but one thing it doesn't do is tell you what number quote your one is when you add one, meaning you would either have to spam !quote or keep using !search which isn't ideal and another thing i would love it to do is when you do !quote 1 it says who it's added by but not the day, date and time.

Code:
on *:LOAD: { set %Quote.list } 
on *:TEXT:*:#: {
  if ($1 == !quote) {
    if ($2) {
      if ($2 isnum) {
        if ($read(Quotes.txt,$2) != $null) { msg $chan Quote $chr(35) $+ $2 $+ : $read(Quotes.txt,$2) }
        else { msg # Quote doesn't exist }
      }
      else { msg # Please provide a number }
    }
    else {
      set %lines $rand(1,$lines(Quotes.txt))
      msg $chan Quote $chr(35) $+ %lines $+ : $read(Quotes.txt,%lines)
    }
  }
  if ($1 == !addquote) {
    if ($address($nick,1) isin %Quote.ban) { msg # You are banned from adding quotes! }
    else {
      if ($2) {
        if ($chr(36) isin $2-) { msg # Invalid Characters! }
        else {
          write Quotes.txt $2- $+ , Added by $nick
          msg # Quote Added!
        }
      }
    }
  }  
  if ($1 == !delquote) {
    if ($nick isin %Quote.list) {
      if ($2) {
        if ($read(Quotes.txt,$2) != $null) {
          write -dl $2 Quotes.txt
          msg # Line deleted
        }
        else { msg # Quote doesn't exist }
      }
    }
  }
  if ($1 == !search) {
    if ($2) {
      if ($read(Quotes.txt,w,* $+ $2 $+ *) != $null) {
        msg # $read(Quotes.txt,w,* $+ $2 $+ *)
      }
      else { msg # No results found }
    }
  }
  if ($1 == !lastquote) {
    set %lines $lines(Quotes.txt)
    msg # Quote $chr(35) $+ %lines $+ : $read(Quotes.txt,%lines)
  }
}
menu nicklist {
  .Add/Del user's
  ..$iif($address($1,1) isin %Quote.ban,$style(2)) Add $+($chr(40),$1,$chr(41)): { set %Quote.ban $addtok(%Quote.list,$address($1,1),32) | echo -a User $+($chr(40),$1,$chr(41)) has been added. }
  ..$iif($address($1,1) !isin %Quote.ban,$style(2)) Del $+($chr(40),$1,$chr(41)): { set %Quote.ban $remtok(%Quote.list,$address($1,1),1,32) | echo -a User $+($chr(40),$1,$chr(41)) has been removed. }
  ..$iif(!%Quote.ban,$style(2)) $+($chr(91),$numtok(%Quote.ban,32),$chr(93)) $+(User's,$chr(58)) List them: { echo -a $gettok(%Quote.list,1-,32) }
}


I've tried doing the quote number by trying to copy bits of the code where you do !quote # (# being the number) such as Quote $chr(35) $+ %lines $+ but failed, even tried other bits but never worked. I'm useless when it comes to code frown

razor32 #230715 18/03/11 07:20 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
So you want when you use !quote to return and the nick that has been add the quote?


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #230718 18/03/11 07:37 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
When someone adds a quote like so:

!addquote asd

it'll return 'Added' but not the quote ID (number) like 'Added #3', also when someone does !quote # (# being a number) like so:

!quote 3

it'll return

Quote #3: asd, Added by razor32

But what would be nice is if it returned something like:

Quote #3: asd, Added by razor32 on Thursday 17th March 22:17:03

razor32 #230720 18/03/11 08:00 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Ok try replace

this:
Code:
write Quotes.txt $2- $+ , Added by $nick


with this:

Code:
write Quotes.txt $remove($2-,$chr(35)) $+ , Added by $nick on $asctime(dddd) $asctime(dd) $+ th $asctime(mmmm) $time



Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #230722 18/03/11 09:08 PM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
Originally Posted By: westor
Ok try replace

this:
Code:
write Quotes.txt $2- $+ , Added by $nick


with this:

Code:
write Quotes.txt $remove($2-,$chr(35)) $+ , Added by $nick on $asctime(dddd) $asctime(dd) $+ th $asctime(mmmm) $time


That's awesome man, it works really well!

Do you know what to do about the addquote so it tells you what number your quote is when it says 'Quote Added' to 'Quote Added #3' ?

Thanks grin

razor32 #230723 18/03/11 09:31 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
try replace

this

Code:
msg # Quote Added!


with this:

Code:
 msg # Quote Added $chr(35) $+ $2


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #230725 18/03/11 09:58 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
First of all, let's shorten the /write line...

Code:
write Quotes.txt $remove($2-,$chr(35)) $+ , Added by $nick on $date(dddd dd mmmm HH:nn:ss)


Of course, if you want to have the nd,rd,th,st on the day number, you need to do it differently... something like:

Code:
var %day = $date(dd)
if ($right(%day,1) isnum 1-3) { var %day = $left(%day,1) $+ $replace($right(%day,1),1,1st,2,2nd,3,3rd) }
else { var %day = %day $+ th }
write Quotes.txt $remove($2-,$chr(35)) $+ , Added by $nick on $date(dddd) %day $date(mmmm HH:nn:ss)


Second, you can't use $2 for the quote number... Use $lines.

Code:
msg # Quote Added $chr(35) $+ $lines(quotes.txt)


Invision Support
#Invision on irc.irchighway.net
Riamus2 #230791 20/03/11 04:33 PM
Joined: Oct 2009
Posts: 24
Ameglian cow
Offline
Ameglian cow
Joined: Oct 2009
Posts: 24
Quote:
$date(dddd dd mmmm HH:nn:ss)


You can use the oo beside the dd as such to return the correct st, rd, nd, or th.

Code:
$date(dddd ddoo mmmm HH:nn:ss)







Last edited by Scakk; 20/03/11 04:33 PM.
Scakk #230794 20/03/11 05:44 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: Scakk
Quote:
$date(dddd dd mmmm HH:nn:ss)


You can use the oo beside the dd as such to return the correct st, rd, nd, or th.

Code:
$date(dddd ddoo mmmm HH:nn:ss)


o_O i didn't know that! nice Scakk!


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Scakk #230798 20/03/11 09:05 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Nice. I didn't know about that either. Of course, it is in the help file. I just haven't read that part in a very long time. blush


Invision Support
#Invision on irc.irchighway.net
Riamus2 #230800 20/03/11 09:14 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
The mIRC "bible" is our best friend when in doubt...though it's not 100% to have included all the deprecated and undocumented commands and identifiers. :p


Link Copied to Clipboard