User Control Panel
|
|
|
 |
Advertisements
|
 |
|
|
|
HELP US, HELP YOU!
|
| Author |
Message |
Cheater Senior Member

Joined: 10 Jun 2005 Posts: 236
  
|
Posted: Fri Jul 29, 2005 10:16 pm Post subject: Dos Bot Guess My Number |
|
|
This is a simple Guess My Number command for Dos Bot. Please see the Dos Bot post in the Bots forum for info on how to install it.
Usage: !number
Example (correct guess):
| Quote: |
!number
Please enter the highest possible number I can choose
50
Please guess a number 1-50
37
You guessed my number correct, nice job
|
Example (wrong guess):
| Quote: |
!number
Please enter the highest possible number I can choose
50
Please guess a number 1-50
37
Your Guess: 37
My Number: 15
Better luck next time
|
Here is the code:
| Code: |
&number;
sub number {
print "Please enter the highest possible number I can choose\n";
my $max = <STDIN>;
chomp $max;
print "Please guess a number 1-$max\n";
my $guess = <STDIN>;
chomp $guess;
my $number = int (rand($max)) + 1;
if ($guess eq $number) {
print "You guessed my number correct, nice job\n";
}
else {
print "Your Guess: $guess\n";
print "My Number: $number\n";
print "Better luck next time\n";
}
}
|
Save it as number.pl in your commands folder.
Note: You should leave the &number; part at the top of the sub there. I might use it in a later version (might not though) |
|
| Back to top |
|
 |
draget Not Yet a God

Joined: 29 Dec 2004 Posts: 367 Location: Australia
   
|
Posted: Sat Jul 30, 2005 12:49 am Post subject: |
|
|
| why bother with the sub? |
|
| Back to top |
|
 |
|
|