User Control Panel
Advertisements

HELP US, HELP YOU!

Quote machine

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Fri Apr 01, 2005 11:13 am    Post subject: Reply with quote

I got fed up with all the !yomma and all the random things as seperate and there is hell of a lot of them on here so i though i'd stop a couple of them with this.

You need to change the directory in line 11 to where you store you're quotes and you cant have any other .txt files in that directory otherwise they will be included...

You need to name the text files what you want them to appear in the menu...

At the moment its for my evolution template but with some minor adjustments it can be changed.....


Code:
sub quotes{<br />    my ($bot,$self, $user, $name, $msg, $color) = @_;<br /><br />   my $reply;<br />   my $str;<br />   my @quotes;<br />   if($msg eq ''){<br />  $reply = "[cool]Which of the following files should i grab a quote for? EG. \"!quotes 4\"\n";<br /><br />  my $num = 0;<br />  opendir(DIR, "./Stuff/machine/");<br />  foreach $file (sort(grep(!/^\./, readdir(DIR)))) {<br />     $file =~ s/\.(.*)$//g;<br />     $num++;<br />     if($num < 10){<br />       $num = "0" . $num if($num  !~ /^0/i);<br />     }<br />     $reply .= "\n$num\) $file";<br />     <br />  }<br />  $reply .= "\n\nType the number of the quote you wish to grab....";<br />  $bot->{store}->{users}->{$user}->{callback} = "quotes";<br />   }<br />   <br /><br />   else{<br />  opendir(DIR, "./Stuff/machine/");<br />  my $numa = 0;<br />  foreach $file (sort(grep(!/^\./, readdir(DIR)))) {<br />     $numa++;<br />     $file =~ s/\.(.*)$//g;<br />     if($msg eq $numa || $msg eq "0" . $numa){    <br />    open (FILE, "< ./Stuff/machine/$file.txt") or return "Could not open $file"; <br />    @lines = <FILE>;<br />    close (FILE); <br />    chomp (@lines); <br />    $str =  $lines[int(rand(scalar(@lines)))]; <br />    delete $bot->{store}->{users}->{$user}->{callback};<br />    $reply = "Quote from $file:\n$bot->{dot} $str";<br />     }<br />  <br />  last if defined $str;<br />  }   <br />  if(!defined $str){<br />     $reply = "[error] Invalid file to get a quote from, Please choose from the list you were provided with!";<br />  }<br />   }   <br />return $reply;   <br />}<br />{<br />   Category => 'FUNNY',<br />   Description => 'GRAB A RANDOM QUOTE FROM THE QUOTE MACHINE\!',<br />   Usage => '!quotes / !quotes <quote file>',<br />};



and here's me playing with it...
QUOTE(Quotes command in action on my bot)
Daz [www.evobot.net - Back up!]  MsgPlus! says:
!quotes

Evolution [evobot.net] says:
Which of the following files should i grab a quote for? EG. "!quotes 4"

01) aol disk
02) church excuses
03) excuses
04) labels
05) palindrome
06) panagram
07) phobia
0Cool stupid questions
09) work excuses
10) yomama

Type the number of the quote you wish to grab....

Daz [www.evobot.net - Back up!]  MsgPlus! says:
!quotes 2

Evolution [evobot.net] says:
Quote from church excuses:
• There aren't any good-looking girls there.

Daz [www.evobot.net - Back up!]  MsgPlus! says:
!quotes 02

Evolution [evobot.net] says:
Quote from church excuses:
• There are too many hypocrites in church.

Daz [www.evobot.net - Back up!]  MsgPlus! says:
!quotes 4935

Evolution [evobot.net] says:
  Invalid file to get a quote from, Please choose from the list you were provided with!
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Fri Apr 01, 2005 2:44 pm    Post subject: Reply with quote

neat.

could you please attach the files?
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Fri Apr 01, 2005 3:21 pm    Post subject: Reply with quote

and do all the work for you?

Now why would i do that Wink
Back to top
draget
Not Yet a God
Not Yet a God


Joined: 29 Dec 2004
Posts: 367
Location: Australia
Reputation: 32.2Reputation: 32.2Reputation: 32.2

PostPosted: Fri Apr 01, 2005 3:38 pm    Post subject: Reply with quote

so now i guess im off forum searching <_<
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Fri Apr 01, 2005 4:07 pm    Post subject: Reply with quote

wow! people actually know about that?
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 01, 2005 5:26 pm    Post subject: Reply with quote

Laughing Laughing Laughing Laughing Laughing Laughing

Haha, that's funny.

Laughing Laughing Laughing Laughing Laughing Laughing

No wait a minute, I'm not done holding my side!

Laughing Laughing Laughing

:rolleyes: You post the perfectly useable code, but don't attach files, and so apparently it's too much work for somebody to just copy the code to a text file and save it.... so they leave to find another forum where people do post downloadible code. Laughing Laughing Laughing That's funny.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
mat007
Almost An Agent
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Fri Apr 01, 2005 6:13 pm    Post subject: Reply with quote

Hes on about the jokes cer?
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Fri Apr 01, 2005 7:52 pm    Post subject: Reply with quote

Cer, stuck you're foot in you're mouth

He meant the "quote" files...like yomama.txt ect....Very Happy

Tooks me couple of mins to work out what you were on about :huh:
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Fri Apr 01, 2005 7:58 pm    Post subject: Reply with quote

QUOTE(Dazzy @ Apr 1 2005, 02:52 PM)
Cer, stuck you're foot in you're mouth

He meant the "quote" files...like yomama.txt ect....Very Happy

Tooks me couple of mins to work out what you were on about :huh:
[right][snapback]47443[/snapback][/right]


Ohhh. I thought he meant the Perl files. Razz It's really something that could be interpreted either way.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group