User Control Panel
Advertisements

HELP US, HELP YOU!

Work

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
purcelly
God Like
God Like


Joined: 10 Jun 2004
Posts: 560
Location: North West, England
Reputation: 35.1Reputation: 35.1Reputation: 35.1Reputation: 35.1

PostPosted: Fri Dec 31, 2004 7:16 pm    Post subject: Reply with quote

in elsif

Code:
#Made By Purcelly <br />#For Innington<br /><br />if($msg =~ /^!work/)<br />{<br />&send($self,"Here is one way to get out of going to work:");<br />open (FILE, "./work.txt");<br />@bat = <FILE>;<br />close (FILE);<br /> $result = $quotes[int(rand(scalar(@quotes)))];<br /> $self->sendmsg("$result", Font => "Arial",Color => '017151',Effect => "B");}<br />}
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Fri Dec 31, 2004 7:35 pm    Post subject: Reply with quote

Ok, so basically you've shown everyone had to get a random line from a text file. And you've shown that to us in FOUR different posts. You could easily make one function that takes a text file and returns a random string from it. Then you could have posted text files to use with it. Also, no matter how many thousand times we've told people to use my in their code, you stil don't. That's just going to lead to bugs in the future.

Also, why not make the functionality interesting and allow searching: !work fish, which would find a random work excuse related to 'fish'.

EDIT: Make that FIVE copies of basically the same code. You need to learn how to factor out common functionality to reduce code size AND make it more powerful.
Back to top
purcelly
God Like
God Like


Joined: 10 Jun 2004
Posts: 560
Location: North West, England
Reputation: 35.1Reputation: 35.1Reputation: 35.1Reputation: 35.1

PostPosted: Sat Jan 01, 2005 11:32 pm    Post subject: Reply with quote

heres the working code


Code:
#Made By Purcelly-tech<br /><br />if ($msg eq "work) {<br />open (FILE, "./work.txt");<br />@bat = <FILE>;<br />close (FILE);<br />my $result = $bat[ int rand scalar @bat];<br />$self->sendmsg("$result", Font => "Arial",Color => '017151',Effect => "B");}
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