|
Joined: Sep 2008
Posts: 37
Ameglian cow
|
OP
Ameglian cow
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. 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
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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?
|
|
|
|
Joined: Sep 2008
Posts: 37
Ameglian cow
|
OP
Ameglian cow
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
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Ok try replace this:
write Quotes.txt $2- $+ , Added by $nick
with this: write Quotes.txt $remove($2-,$chr(35)) $+ , Added by $nick on $asctime(dddd) $asctime(dd) $+ th $asctime(mmmm) $time
|
|
|
|
Joined: Sep 2008
Posts: 37
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2008
Posts: 37 |
Ok try replace this:
write Quotes.txt $2- $+ , Added by $nick
with this: 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
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
try replace this with this: msg # Quote Added $chr(35) $+ $2
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
First of all, let's shorten the /write line... 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:
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. msg # Quote Added $chr(35) $+ $lines(quotes.txt)
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2009
Posts: 24
Ameglian cow
|
Ameglian cow
Joined: Oct 2009
Posts: 24 |
$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. $date(dddd ddoo mmmm HH:nn:ss)
Last edited by Scakk; 20/03/11 04:33 PM.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
$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. $date(dddd ddoo mmmm HH:nn:ss) o_O i didn't know that! nice Scakk!
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
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.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jul 2007
Posts: 1,129
Hoopy frood
|
Hoopy frood
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
|
|
|
|
|