This is a pointless command to keep an idiot occupied.
This is how it goes...
Quote:
AiChaos: !idiot CodyCKS: Are you sure you want to learn how to keep an idiot occupied? AiChaos: Yes. CodyCKS: Are you absolutely positive? AiChaos: Yes. CodyCKS: I'm about to tell you. Do you really want to know? AiChaos: YES! CodyCKS: If you really want to know, say so now. AiChaos: "So" CodyCKS: Alright, give the word one more time and I'll reveal the secret. AiChaos: TELL ME! CodyCKS: Congratulations, you now know the secret to keeping an idiot occupied.
Anyhow, here it is.
Code:
# COMMAND NAME:<br /># IDIOT<br /># DESCRIPTION:<br /># Keep an idiot occupied.<br /># COMPATIBILITY:<br /># FULLY COMPATIBLE<br /><br />sub idiot {<br /> # Get variables from the shift.<br /> my ($self,$client,$msg,$listener) = @_;<br /><br /> # See what number they're on.<br /> if ($chaos->{_users}->{$client}->{_idiot}->{step} == 1) {<br /> $chaos->{_users}->{$client}->{_idiot}->{step} = 2;<br /> return "Are you absolutely positive?";<br /> }<br /> elsif ($chaos->{_users}->{$client}->{_idiot}->{step} == 2) {<br /> $chaos->{_users}->{$client}->{_idiot}->{step} = 3;<br /> return "I'm about to tell you. Do you really want to know?";<br /> }<br /> elsif ($chaos->{_users}->{$client}->{_idiot}->{step} == 3) {<br /> $chaos->{_users}->{$client}->{_idiot}->{step} = 4;<br /> return "If you really want to know, say so now.";<br /> }<br /> elsif ($chaos->{_users}->{$client}->{_idiot}->{step} == 4) {<br /> $chaos->{_users}->{$client}->{_idiot}->{step} = 5;<br /> return "Alright, give the word one more time and I'll reveal the secret.";<br /> }<br /> elsif ($chaos->{_users}->{$client}->{_idiot}->{step} == 5) {<br /> # Delete the variables.<br /> delete $chaos->{_users}->{$client}->{callback};<br /> delete $chaos->{_users}->{$client}->{_idiot}->{step};<br /><br /> return "Congratulations, you now know the secret to keeping an idiot occupied.";<br /> }<br /> else {<br /> # Set the callback.<br /> $chaos->{_users}->{$client}->{callback} = "idiot";<br /><br /> # Set the step to #1.<br /> $chaos->{_users}->{$client}->{_idiot}->{step} = 1;<br /><br /> # Return the reply.<br /> return "Are you sure you want to learn how to keep an idiot occupied?";<br /> }<br />}<br />1;
sub idiot<br />{<br /><br /># Get variables from the shift.<br /><br />my ($bot, $self, $user, $msg) = @_;<br /><br />if ($bot->{users}->{$user}->{_idiot}->{step} == 1) {<br /> $bot->{users}->{$user}->{_idiot}->{step} = 2;<br /> return "Are you absolutely positive?";<br />}<br />elsif ($bot->{users}->{$user}->{_idiot}->{step} == 2) {<br /> $bot->{users}->{$user}->{_idiot}->{step} = 3;<br /> return "I'm about to tell you. Do you really want to know?";<br />}<br />elsif ($bot->{users}->{$user}->{_idiot}->{step} == 3) {<br /> $bot->{users}->{$user}->{_idiot}->{step} = 4;<br /> return "If you really want to know, say so now.";<br />}<br />elsif ($bot->{users}->{$user}->{_idiot}->{step} == 4) {<br /> $bot->{users}->{$user}->{_idiot}->{step} = 5;<br /> return "Alright, give the word one more time and I'll reveal the secret.";<br />}<br />elsif ($bot->{users}->{$user}->{_idiot}->{step} == 5) {<br /> # Delete the variables.<br /> delete $bot->{users}->{$user}->{callback};<br /> delete $bot->{users}->{$user}->{_idiot}->{step};<br /><br /> return "Congratulations, you now know the secret to keeping an idiot occupied.";<br />}<br />else {<br /> # Set the callback.<br /> $bot->{users}->{$user}->{callback} = "idiot";<br /> # Set the step to #1.<br /> $bot->{users}->{$user}->{_idiot}->{step} = 1;<br /><br /> # Return the reply.<br /> return "Are you sure you want to learn how to keep an idiot occupied?";<br />}<br /><br />}<br /><br />{<br /> <br />};
Joined: 03 May 2006 Posts: 2292 Location: Colorado
Posted: Mon Apr 12, 2004 6:11 pm Post subject:
Slightly better version. Switched to an array of answers so that you can add more easily. Just add them in there and they work. No need to change the numbers at all. Oh and i indented the code! that makes it look all nice and tidy.
Code:
sub idiot<br />{<br /> my ($bot, $self, $user, $msg) = @_;<br /> $bot->{users}->{$user}->{_idiot}->{step} ||= 0;<br /> $bot->{users}->{$user}->{_idiot}->{step}++;<br /> $bot->{users}->{$user}->{callback} = "idiot";<br /> <br /> my @steps = (<br /> "Are you sure you want to learn how to keep an idiot occupied?",<br /> "Are you absolutely positive?",<br /> "I'm about to tell you. Do you really want to know?", <br /> "If you really want to know, say so now.",<br /> "Alright, give the word one more time and I'll reveal the secret.",<br /> "Congratulations, you now know the secret to keeping an idiot occupied.",<br /> );<br /> my $msg = @steps[$bot->{users}->{$user}->{_idiot}->{step} - 1];<br /> if ($bot->{users}->{$user}->{_idiot}->{step} > scalar(@steps)) {<br /> # Delete the variables.<br /> delete $bot->{users}->{$user}->{callback};<br /> delete $bot->{users}->{$user}->{_idiot}->{step}; <br /> }<br /> return $msg;<br />}
_________________ Eric256
Proud previous owner and current admin of Bot-depot.com