User Control Panel
Advertisements

HELP US, HELP YOU!

Monkey Island Duels

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


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

PostPosted: Sat Mar 26, 2005 2:45 am    Post subject: Reply with quote

This is a fun command that allows you to duel with somebody, Monkey Island style!

If you don't know what Monkey Island is, it was a pretty good point-and-click adventure game for the Windows 95 times. In the game, you'd get into sword fights with pirates and you fight with insults. One person would throw an insult, and if you make a good comeback it puts you in the lead to throw an insult back at them.

For example:
Insult: You fight like a dairy farmer.
Comeback: How appropriate, you fight like a cow.

If you know about the MsgPlus easter egg, /insult, that's what this is like -- except it works on AIM too!

Usage: !fight
Unlike other commands, in this case is JUST their handle (i.e. name@passport.net, not MSN-name@passport.net).

You can't pick fights with somebody on a different messenger than yourself. On MSN, the user must allow the bot to contact them (if they don't have the bot on their list or they have privacy settings set, you can't duel with them).

You first pick a victim. The bot IM's them saying you're picking a fight, they give you a random insult ("from you") and a list of responses. They pick the correct response, and the bot comes back to the antagonist--you--with their response, and gives you a list of comebacks.

The first one to use a bad comeback or to surrender (typing "quit") loses the duel.

No points are wagered or anything, this game has no real point, it's just fun.

Installation:
Quote:
This command required a small modification to Leviathan's &gamesend subroutine--this subroutine handles Games::Manager's broadcasting.

• Extract fight.pl to your commands/2pgames folder.
• Extract gamesend.pl to overwrite your subroutines/gamesend.pl
• IF, for some reason, you are missing Games::Manager, extract Manager.pm to your lib/Games folder.


And finally.... the code!

Code:
#      .   .               <Leviathan><br />#     .:...::     Command Name // !fight<br />#    .::   ::.     Description // Pick a fight with someone.<br /># ..:;;. ' .;;:..        Usage // !fight <username><br />#    .  '''  .     Permissions // Public<br />#     :;,:,;:         Listener // AIM,MSN<br />#     :     :        Copyright // 2005 AiChaos Inc.<br /><br />sub fight {<br />     my ($self,$client,$msg) = @_;<br /><br />     # Monkey-Island style fight game.<br />     # Written 3-25-2005 by Cerone Kirsle.<br />     # Please give some credit if you port this<br />     # to a different bot template!<br /><br />     # AIM and MSN Only.<br />     my ($a,$b) = split(/\-/, $client, 2);<br />     return "This command is for AIM and MSN only." unless $a =~ /^(AIM|MSN)$/i;<br /><br />     # Comebacks.<br />     my %out = (<br />          0 => 'And I\'ve got a little TIP for you, get the POINT?',<br />          1 => 'First you better stop waiving it like a feather-duster.',<br />          2 => 'So you got that job as a janitor, after all.',<br />          3 => 'Even BEFORE they smell your breath?',<br />          4 => 'He must have taught you everything you know.',<br />          5 => 'You make me think somebody already did.',<br />          6 => 'You run THAT fast?',<br />          7 => 'How appropriate, you fight like a cow.',<br />          8 => 'I hope now you\'ve learned to stop picking your nose.',<br />          9 => 'Why, did you want to borrow one?',<br />          10 => 'Too bad no one\'s ever heard of YOU at all.',<br />          11 => 'I\'d be in real trouble if you ever used them.',<br />          12 => 'I wanted to make sure you\'d feel comfortable with me.',<br />          13 => 'Your hemorrhoids are flaring up again, eh?',<br />          14 => 'Yes there are. You just never learned them.',<br />          15 => 'I\'m glad to hear you attented your family reunion.',<br />          16 => 'With your breath, I\'m sure they all suffocated.',<br />          17 => 'I look that much like your fiancée?',<br />          18 => 'Then killing you must be justifiable fungicide.',<br />          19 => 'If you don\'t count all the ones you\'ve dated!',<br />          20 => 'When I\'m done with you, you\'ll be a boneless filet.',<br />          21 => 'With you around, I\'d rather be fumigated.',<br />          22 => 'Is that your face? I thought it was your backside.',<br />          23 => 'At least mine can be identified.',<br />          24 => 'I could, if you would use some breath spray.',<br />          25 => 'You would have, but you were always running away.',<br />          26 => 'Oh, that is so cliché.',<br />          27 => 'Too bad they\'re all fabricated.',<br />          28 => 'Then perhaps you should switch to decaffeinated.',<br />          29 => 'Your odor alone makes me aggravated, agitated, and infuriated.',<br />          30 => 'The only way you\'ll be preserved is in formaldehyde.',<br />          31 => 'Then be a good dog, Sit! Stay!',<br />          32 => 'From the size of your gut I\'d guess they were eaten.',<br />          33 => 'It\'s too bad none of them are in your arms.',<br />          34 => 'I would if it would stop your WINE-ING.',<br />          35 => 'Yeah, but we both got better bladder control than you do.',<br />          36 => 'Why, ya studying to be a nurse?',<br />          37 => 'I\'m surprised you can count that high!',<br />          38 => 'Yeah, yeah I know: it\'s a three headed monkey.',<br />          39 => 'I thought that the bean dip had a strange taste.',<br />          40 => 'So THAT\'S why you\'re scratching. I\'d go see a vet.',<br />          41 => 'Sadly, your breath should be equally reckoned.',<br />          42 => 'I\'m shocked that you\'ve never gazed at your wife.',<br />          43 => 'An over-the-counter defoliant could help with that problem.',<br />          44 => 'I\'m sure that spineless creatures everywhere are humbled by your might.',<br />          45 => 'It\'s laughter that\'s caused by your feathery grip.',<br />     );<br /><br />     # The insults and comebacks.<br />     my %in = (<br />          'This is the END for you, you gutter-crawling cur!' => 0,<br />          'Soon you\'ll be wearing my sword like a shisk kebab!' => 1,<br />          'My handkerchief will wipe up your blood!' => 2,<br />          'People fall at my feet when they see me coming.' => 3,<br />          'I once owned a dog that was smarter than you.' => 4,<br />          'You make me want to puke.' => 5,<br />          'Nobody\'s ever drawn blood from me and nobody ever will.' => 6,<br />          'You fight like a dairy farmer.' => 7,<br />          'I got this scar on my face during a mighty struggle!' => 8,<br />          'Have you stopped wearing diapers yet?' => 9,<br />          'I\'ve heard you were a contemptible sneak.' => 10,<br />          'You\'re no match for my brains, you poor fool.' => 11,<br />          'You have the manners of a beggar.' => 12,<br />          'I\'m not going to take your insolence sitting down!' => 13,<br />          'There are no words for how disgusting you are.' => 14,<br />          'I\'ve spoken with apes more polite than you.' => 15,<br />          'Every enemy I have met, I\'ve annihilated!' => 16,<br />          'You\'re as repulsive as a monkey in a negligee!' => 17,<br />          'Killing you would be justifiable homocide!' => 18,<br />          'You\'re the ugliest monster ever created!' => 19,<br />          'I\'ll skewer you like a sow at a buffet!' => 20,<br />          'Would you like to be buried, or cremated?' => 21,<br />          'Coming face to face with me must leave you petrified!' => 22,<br />          'When your father first saw you, he must have been mortified.' => 23,<br />          'You can\'t match my witty repartee!' => 24,<br />          'I have never seen such clumsy swordplay!' => 25,<br />          'En Garde! Touché!' => 26,<br />          'Throughout the Caribbean, my great deeds are celebrated!' => 27,<br />          'I can\'t rest \'til\' you\'ve been exterminated!' => 28,<br />          'I\'ll leave you devastated, mutiliated, and perforated!' => 29,<br />          'Heaven preserve me! You look like something that\'s died!' => 30,<br />          'I\'ll hound you night and day!' => 31,<br />          'Today, by myself, twelve people I\'ve beaten.' => 32,<br />          'I\'ve got muscles in places you\'ve never even heard of.' => 33,<br />          'Give up now, or I\'ll crush you like a grape!' => 34,<br />          'My ninety-eight year old grandmother has bigger arms than you!' => 35,<br />          'I\'m going to put your arm in a sling!' => 36,<br />          'My stupefying strength will shatter your ulna into a million pieces!' => 37,<br />          'Hey, look over there!' => 38,<br />          'Your knuckles I\'ll grind to a splintery paste.' => 39,<br />          'Your arms are no bigger than fleas I\'ve met!' => 40,<br />          'People consider my fists lethal weapons!' => 41,<br />          'Only once have I met such a coward!' => 4,<br />          'You\'re the ugliest creature I\'ve ever seen in my life.' => 42,<br />          'My forearms have been mistaken for tree trunks.' => 43,<br />          'I\'ve out-wrestled octopi with these arms!' => 44,<br />          'Do I see quivers of agony dance on your lip?' => 45,<br />     );<br /><br />     # Player 1 = the antagonist<br />     # Player 2 = the victim<br /><br />     my $sn;<br />     $sn = $self->screenname() if $a eq 'AIM';<br />     $sn = $self->{Msn}->{Handle} if $a eq 'MSN';<br />     $sn = lc($sn);<br />     $sn =~ s/ //g;<br /><br />     # Picking a fight?<br />     if (!exists $chaos->{clients}->{$client}->{_attack}) {<br />          # See if there's a valid target.<br />          if (length $msg > 0) {<br />               # Make a unique Game ID.<br />               my ($listener,$name) = split(/\-/, $client, 2);<br />               my $id = join ('-', $client, $msg);<br />               my $target = join ('-', $listener, $msg);<br /><br />               # Is this user busy elsewhere?<br />               if (exists $chaos->{clients}->{$target}->{_attack}) {<br />                    return "$msg is already busy with a duel with somebody else.";<br />               }<br /><br />               # Get this user's profile (in case they're a new user).<br />               &profile_get ($target);<br /><br />               $chaos->{clients}->{$client}->{host} = $sn;<br />               $chaos->{clients}->{$target}->{host} = $sn;<br />               $chaos->{clients}->{$client}->{_attack} = $id;       # Set ID for antagonist.<br />               $chaos->{clients}->{$client}->{_attkplayer} = 1;     # Antagonist is Player 1.<br />               $chaos->{clients}->{$client}->{callback} = 'fight'; # Set callback for antagonist.<br />               $chaos->{clients}->{$client}->{_attktarget} = $target; # Antagonist's target.<br />               $chaos->{clients}->{$target}->{_attack} = $id;       # Set ID for victim.<br />               $chaos->{clients}->{$target}->{_attkplayer} = 2;     # Victim is Player 2.<br />               $chaos->{clients}->{$target}->{callback} = 'fight'; # Set callback for victim.<br />               $chaos->{clients}->{$target}->{_attktarget} = $client; # Victim's target.<br />               $chaos->{clients}->{$client}->{_attkturn} = 2;       # It is the victim's turn to fight back.<br />               $chaos->{clients}->{$target}->{_attkturn} = 2;       # It is the victim's turn to fight back.<br /><br />               # Create the game.<br />               $chaos->{games}->create (<br />                    id   => $id,<br />                    name => 'Fight',<br />               );<br /><br />               # Add both players.<br />               $chaos->{games}->addPlayer ($id, name => $client);<br />               $chaos->{games}->addPlayer ($id, name => $target);<br /><br />               # Pick a random insult.<br />               my @insults = keys %in;<br />               my $rand = $insults [ int(rand(scalar(@insults))) ];<br /><br />               # Provide a few options.<br />               my @nums = ();<br />               push (@nums, $in{$rand}); # The correct response.<br />               while (scalar(@nums) < 4) {<br />                    # Pick a random number from 0 to 15.<br />                    my $key = int(rand(16));<br /><br />                    my $found = 0;<br />                    foreach my $already (@nums) {<br />                         if ($key == $already) {<br />                              $found = 1;<br />                         }<br />                    }<br />                    push (@nums, $key) unless $found;<br />               }<br /><br />               # Shuffle the array.<br />               for (my $i = 0; $i < scalar(@nums); $i++) {<br />                    my $j = int(rand(scalar(@nums)));<br />                    ($nums[$i],$nums[$j]) = ($nums[$j],$nums[$i]);<br />               }<br /><br />               # Prepare the message being sent to the victim.<br />               my $send = "$name has picked a fight with you!\n\n"<br />                    . "He said:\n"<br />                    . "<gt><gt> $rand\n\n"<br />                    . "You shouldn't take this! Fight back!\n"<br />                    . "A. $out{$nums[0]}\n"<br />                    . "B. $out{$nums[1]}\n"<br />                    . "C. $out{$nums[2]}\n"<br />                    . "D. $out{$nums[3]}\n\n"<br />                    . "You can surrender at any time by typing \"quit\".";<br /><br />               # Save the answers.<br />               $chaos->{clients}->{$target}->{_attkinsult} = $rand;<br />               $chaos->{clients}->{$target}->{_attkopts} = {<br />                    a => $nums[0],<br />                    b => $nums[1],<br />                    c => $nums[2],<br />                    d => $nums[3],<br />               };<br /><br />               # Send a message to the victim.<br />               $chaos->{games}->sendMessage (<br />                    to      => $target,<br />                    message => $send,<br />               );<br />               return "You have picked a fight with $msg.\n\n"<br />                    . "<gt><gt> $rand\n\n"<br />                    . "Awaiting their response... you can surrender at any time by typing \"quit\".";<br />          }<br />          else {<br />               return "Tell me who to attack when calling this command:\n\n"<br />                    . "i.e.\n"<br />                    . "!insult screenname";<br />          }<br />     }<br />     else {<br />          # See whose turn it is.<br />          my $player = $chaos->{clients}->{$client}->{_attkplayer};<br />          my $turn = $chaos->{clients}->{$client}->{_attkturn};<br /><br />          if ($msg =~ /^quit$/i) {<br />               my $target = $chaos->{clients}->{$client}->{_attktarget};<br /><br />               # Kill the game.<br />               $chaos->{games}->destroy (<br />                    id      => $chaos->{clients}->{$client}->{_attack},<br />                    force   => 1,<br />                    alert   => 1,<br />                    message => "$client has chickened out! $target won!",<br />               );<br /><br />               delete $chaos->{clients}->{$client}->{host};<br />               delete $chaos->{clients}->{$target}->{host};<br />               delete $chaos->{clients}->{$client}->{_attack};<br />               delete $chaos->{clients}->{$client}->{_attkplayer};<br />               delete $chaos->{clients}->{$client}->{callback};<br />               delete $chaos->{clients}->{$client}->{_attktarget};<br />               delete $chaos->{clients}->{$target}->{_attack};<br />               delete $chaos->{clients}->{$target}->{_attkplayer};<br />               delete $chaos->{clients}->{$target}->{callback};<br />               delete $chaos->{clients}->{$target}->{_attktarget};<br />               delete $chaos->{clients}->{$client}->{_attkturn};<br /><br />               return "<noreply>";<br />          }<br /><br />          # Our turn?<br />          if ($player == $turn) {<br />               # See what answer they picked.<br />               if ($msg =~ /^(a|b|c|d)$/i) {<br />                    $msg = lc($msg);<br />                    my $key = $chaos->{clients}->{$client}->{_attkopts}->{$msg};<br />                    my $correct = $in{$chaos->{clients}->{$client}->{_attkinsult}};<br />                    if ($key == $correct) {<br />                         # They fought back!<br />                         my ($listener,$name) = split(/\-/, $client, 2);<br /><br />                         # Find the victim now.<br />                         my $victim = $chaos->{clients}->{$client}->{_attktarget};<br />                         my $target = $chaos->{clients}->{$client}->{_attktarget};<br />                         my ($l,$n) = split(/\-/, $victim, 2);<br />                         $victim = $n;<br /><br />                         # Change the turn.<br />                         if ($turn == 1) {<br />                              $turn = 2;<br />                         }<br />                         else {<br />                              $turn = 1;<br />                         }<br />                         $chaos->{clients}->{$client}->{_attkturn} = $turn;<br />                         $chaos->{clients}->{$target}->{_attkturn} = $turn;<br /><br />                         # Pick a random insult.<br />                         my @insults = keys %in;<br />                         my $rand = $insults [ int(rand(scalar(@insults))) ];<br /><br />                         # Provide a few options.<br />                         my @nums = ();<br />                         push (@nums, $in{$rand}); # The correct response.<br />                         while (scalar(@nums) < 4) {<br />                              # Pick a random number from 0 to 15.<br />                              my $key = int(rand(16));<br /><br />                              my $found = 0;<br />                              foreach my $already (@nums) {<br />                                   if ($key == $already) {<br />                                        $found = 1;<br />                                   }<br />                              }<br />                              push (@nums, $key) unless $found;<br />                         }<br /><br />                         # Shuffle the array.<br />                         for (my $i = 0; $i < scalar(@nums); $i++) {<br />                              my $j = int(rand(scalar(@nums)));<br />                              ($nums[$i],$nums[$j]) = ($nums[$j],$nums[$i]);<br />                         }<br /><br />                         # Prepare the message being sent to the victim.<br />                         my $send = "$name has fought back!\n\n"<br />                              . "They said:\n"<br />                              . "<lt><lt> $out{$key}\n"<br />                              . "<gt><gt> $rand\n\n"<br />                              . "You shouldn't take this! Fight back!\n"<br />                              . "A. $out{$nums[0]}\n"<br />                              . "B. $out{$nums[1]}\n"<br />                              . "C. $out{$nums[2]}\n"<br />                              . "D. $out{$nums[3]}\n\n"<br />                              . "You can surrender at any time by typing \"quit\".";<br /><br />                         # Save the answers.<br />                         $chaos->{clients}->{$target}->{_attkinsult} = $rand;<br />                         $chaos->{clients}->{$target}->{_attkopts} = {<br />                              a => $nums[0],<br />                              b => $nums[1],<br />                              c => $nums[2],<br />                              d => $nums[3],<br />                         };<br /><br />                         # Send a message to the victim.<br />                         $chaos->{games}->sendMessage (<br />                              to      => $target,<br />                              message => $send,<br />                         );<br /><br />                         # Refresh the victim's callback.<br />                         $chaos->{clients}->{$target}->{callback} = 'fight';<br /><br />                         return "You have fought back against $victim.\n\n"<br />                              . "<lt><lt> $out{$key}\n"<br />                              . "<gt><gt> $rand\n\n"<br />                              . "Awaiting their response... you can surrender at any time by typing \"quit\".";<br />                    }<br />                    else {<br />                         # WRONG!<br /><br />                         # Find the victim now.<br />                         my ($listener,$name) = split(/\-/, $client, 2);<br />                         my $victim = $chaos->{clients}->{$client}->{_attktarget};<br />                         my $target = $chaos->{clients}->{$client}->{_attktarget};<br />                         my ($l,$n) = split(/\-/, $victim, 2);<br />                         $victim = $n;<br /><br />                         my $send = "$name has fought back!\n\n"<br />                              . "They said:\n"<br />                              . "<lt><lt> $out{$key}\n\n"<br />                              . "You have won this battle!";<br /><br />                         $chaos->{games}->sendMessage (<br />                              to      => $target,<br />                              message => $send,<br />                         );<br /><br />                         # Delete the data.<br />                         my $id = $chaos->{clients}->{$client}->{_attack};<br />                         delete $chaos->{clients}->{$client}->{_attack};<br />                         delete $chaos->{clients}->{$client}->{_attkplayer};<br />                         delete $chaos->{clients}->{$client}->{callback};<br />                         delete $chaos->{clients}->{$client}->{_attktarget};<br />                         delete $chaos->{clients}->{$target}->{_attack};<br />                         delete $chaos->{clients}->{$target}->{_attkplayer};<br />                         delete $chaos->{clients}->{$target}->{callback};<br />                         delete $chaos->{clients}->{$target}->{_attktarget};<br />                         delete $chaos->{clients}->{$client}->{_attkturn};<br /><br />                         # Destroy the game.<br />                         $chaos->{games}->dropPlayer ($id,$client);<br />                         $chaos->{games}->dropPlayer ($id,$target);<br />                         $chaos->{games}->destroy (<br />                              id    => $id,<br />                              force => 1,<br />                              alert => 0,<br />                         );<br /><br />                         return "You have fought back against $victim.\n\n"<br />                              . "<lt><lt> $out{$key}\n\n"<br />                              . "You picked the wrong comeback! You have lost!";<br />                    }<br />               }<br />               else {<br />                    return "Invalid option: must be A through D.";<br />               }<br />          }<br />          else {<br />               return "It's not your turn! Wait for your victim to go!";<br />          }<br />     }<br />}<br />{<br />     Category    => 'Multiplayer Games',<br />     Description => 'Pick a fight with someone.',<br />     Usage       => '!fight <username>',<br />     Listener    => 'AIM,MSN',<br />};


Attached.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
shmookey
Newbie
Newbie


Joined: 21 Dec 2004
Posts: 49
Location: Western Australia
Reputation: 17.7Reputation: 17.7

PostPosted: Sat Mar 26, 2005 3:13 am    Post subject: Reply with quote

Cool, I like this because the Monkey Island series are my favourite games. I can imagine non-fans might not get the jokes though, even though they're absolutely classic. Just like to point out that the last game wasn't for Windows 95 nor was it point and click, but it still had the insult games.
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Sat Mar 26, 2005 3:20 am    Post subject: Reply with quote

This looks interesting, but I have some comments for you.

1) You should read the text content in fromfiles rather than hard code it.

2) I'd like to see you start making modules (or commands) that are template-independent. I realize you want to promote your template over everyone elses, but you can get more people to adopt games like this and other code if it can be used as is with other templates. Make this a module, throw out all the hard-coded chaos stuff and you'll have the extra benefit of cleaner, easier to read code.

3) Why is it only for AIM and MSN? Why not for Jabber and Yahoo too? There should be no service-specific code. If you made it modular, you wouldn't have to restrict it to specific services.

4) I also noticed a few other programming issues, like storing all of the user data in a global hash ($chaos->{clients}) and saving the state of the game for both users (the attacker, victim and targets, for example) instead of just game state variables.

Just my two cents.
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: Sat Mar 26, 2005 10:06 am    Post subject: Reply with quote

Cer, will your Games::Manager work with other templates?

or will i have to spend 3 days recoding?
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Sat Mar 26, 2005 5:49 pm    Post subject: Reply with quote

QUOTE(draget @ Mar 26 2005, 05:06 AM)
Cer, will your Games::Manager work with other templates?

or will i have to spend 3 days recoding?
[right][snapback]47240[/snapback][/right]


Yes, it works fine with other templates (that's why I made it into a module instead of hardcoding it into my bot Razz ).

I posted the module in this post, including the synopsis and list of methods.

_________________
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