145
edits
No edit summary |
|||
| (5 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
fortune gives random quotes. Point it to a file and it will give a line of information from that file. strfile is used to create fortune files. A plain fortune file looks like this: | fortune gives random quotes. Point it to a file and it will give a line of information from that file. strfile is used to create fortune files. A plain fortune file looks like this: | ||
Quote 1 | Quote 1 | ||
% | % | ||
Quote 2 | Quote 2 | ||
% | % | ||
Yore ma blows goats | Yore ma blows goats | ||
% | % | ||
joe5ie is the shit | joe5ie is the shit | ||
Save your quotes into a file, and run strfile <filename>. That will create a .dat file. You will need both later on. | Save your quotes into a file, and run strfile <filename>. That will create a .dat file. You will need both later on. | ||
== The Code == | == The Code == | ||
| Line 20: | Line 19: | ||
Here is the code for a fortune file IRC reader thing. You will need to edit the things in bold. | Here is the code for a fortune file IRC reader thing. You will need to edit the things in bold. | ||
use Irssi; | use Irssi; | ||
use Irssi::Irc; | use Irssi::Irc; | ||
use vars qw($VERSION %IRSSI); | use vars qw($VERSION %IRSSI); | ||
$mytimeout; | $mytimeout; | ||
$d_tmout = 0; | $d_tmout = 0; | ||
'''$msecs = 300000;''' | '''$msecs = 300000;''' | ||
'''$limit = 1;''' | '''$limit = 1;''' | ||
sub cmd_hl { | sub cmd_hl { | ||
my ($server, $data, $nick, $mask, $target) =@_; | my ($server, $data, $nick, $mask, $target) =@_; | ||
if ($data=~/^'''!trigger'''/) | if ($data=~/^'''!trigger'''/) | ||
{ | { | ||
| Line 50: | Line 49: | ||
$frtn .= " '''~user/path'''"; | $frtn .= " '''~user/path'''"; | ||
} | } | ||
$cookie = `$frtn`; | $cookie = `$frtn`; | ||
$cookie =~ s/\s*\n\s*/ /g; | $cookie =~ s/\s*\n\s*/ /g; | ||
$cookie =~ s/\t/ /g; | $cookie =~ s/\t/ /g; | ||
| Line 68: | Line 67: | ||
$return = 1; | $return = 1; | ||
} | } | ||
$d_tmout += 1; | $d_tmout += 1; | ||
if ($d_tmout == 1) | if ($d_tmout == 1) | ||
{ | { | ||
| Line 76: | Line 75: | ||
$mytimeout = Irssi::timeout_add_once($msecs, sub {$d_tmout = 0; Irssi::timeout_remove($mytimeout);print NOTICES $ | $mytimeout = Irssi::timeout_add_once($msecs, sub {$d_tmout = 0; Irssi::timeout_remove($mytimeout);print NOTICES $ | ||
} | } | ||
} | } | ||
return $return; | return $return; | ||
} | } | ||
Irssi::signal_add_last('message public', 'cmd_hl'); | Irssi::signal_add_last('message public', 'cmd_hl'); | ||
Irssi::print("quotes script by nchip loaded."); | Irssi::print("quotes script by nchip loaded."); | ||
edits