Joined: 07 May 2005 Posts: 38 Location: Amsterdam, The Netherlands
Posted: Fri Dec 30, 2005 4:10 pm Post subject: Words Game
This is my first Perl code, so don't think it's too great. With a little help on the if(), but the rest I did myself lol.
It works by saying !words <something>.
Hope you like it!
Code:
sub cmd_words {
my($self, $username, $name, $msg) = @_;
if ($msg)
{
if ($msg =~ /^(this|is|the|first|game)$/i)
{
$self->sendMessage("That was 1 of the 5 words, remember it!"
. "\n\t$dot Type !words clue to get help!");
}
elsif ($msg =~ /^(clue)$/i)
{
$self->sendMessage("Word 1: 4 letters, begins with a \'t\' and ends with an \'s\'."
. "\nWord 2: 2 letters."
. "\nWord 3: 3 letters, begins with a \'t\'."
. "\nWord 4: 5 letters, begins with an \'f\' and ends with a \'t\'."
. "\nWord 5: 4 letters, begins with a \'g\'and ends withs an \'e\'."
. "\n\nIf you know the sentence, just say !words <the sentence> and edit <the sentence>. Good Luck.");
}
elsif ($msg =~ /^(this is the first game)$/i)
{
$self->sendMessage("That was the correct sentence! Well Done!");
}
else
{
$self->sendMessage("That was not 1 of the 5 words. Try again!"
. "\n\t$dot Type !words clue to get help!");
}
}
else
{
$self->sendMessage("You have to add a word behind !words.\n"
. "Eg: !words lol");
}