User Control Panel
Advertisements

HELP US, HELP YOU!

help on the snail race command

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Commands
View unanswered posts
Author Message
Drayshak
Young One
Young One


Joined: 06 Jan 2004
Posts: 93
Location: Nottinghamshire, UK
Reputation: 46.2Reputation: 46.2Reputation: 46.2Reputation: 46.2Reputation: 46.2
votes: 4

PostPosted: Thu Mar 04, 2004 8:34 pm    Post subject: Reply with quote

im a bit of a n00b to andromeda callbacks, i cant honestly see anything wrong with this command but apparently there is (btw i had a go at indenting, soz if its wrong)
Code:
sub snails {<br />   my ($bot, $self, $user, $msg, $choice) = @_;<br /><br />   if ($msg eq '')<br />      {<br />           $user_settings->{callback} = "snails";<br />           $self->sendmsg("(sn) Hello and welcome to the Snail Race Stadium (sn)      \nPlease place your bets now by typing bet <snail number>\n(sn) 1, (sn) 2, (sn) 3,(sn) 4,(sn) 5.\nType 'start'");<br />      }            <br />   elsif ($msg eq 'bet')<br />      {   <br />            $self->sendmsg("$user bets on snail No. $msg! Any other bets?"); <br />       }<br />            elsif ($msg eq 'start')<br />       {<br />           $user_settings->{callback} = "";<br />           my $snails = [0,0,0,0,0];<br />           $self->sendmsg("Starting The Race....\n");<br />           my $winner = undef;<br />   <br />           while (not $winner) {  #while there is no winner<br />           my $snail = int rand 5; #pick a snail<br />           $snails->[$snail]++;  # move it<br />           $winner = $snail + 1 if ($snails->[$snail] ge 5); # did it win?<br />           $bot->do_one_loop();  #give other stuff a chance<br />           $self->sendmsg("going ....\n" . showsnails($snails)); #show them<br />           return "(sn) GONE!. Race over. Snail $winner won the race! (sn)";   <br />       }<br />            elsif ($msg eq 'exit')<br />       {   <br />            $user_settings->{callback} = "";<br />            $self->sendmsg("The snail race had to be called off, the snail starting eating a lettuce leaf :P"); <br />       }<br />   <br />   else<br />       {<br />             return "Thats not a snail race option, type 'exit' to quit";<br />       }<br />       <br />   } <br />sub showsnails {<br />   my $snails = shift;<br />   my $reply = "";<br />   my $i = 1;<br />   foreach my $snail (@$snails)<br />   {<br />       $reply .= $i++ . " " . "- " x $snail . "(sn)" . "- " x (5 - $snail) . "\n";<br />   }<br />   return $reply;<br />}

any help Razz thnx
Back to top
Drayshak
Young One
Young One


Joined: 06 Jan 2004
Posts: 93
Location: Nottinghamshire, UK
Reputation: 46.2Reputation: 46.2Reputation: 46.2Reputation: 46.2Reputation: 46.2
votes: 4

PostPosted: Thu Mar 04, 2004 8:43 pm    Post subject: Reply with quote

sorry ive just noticed erics version SORRY for posting this...
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