This is just another magic 8-ball, say !8ball and then your question to be given an answer, by the way, it only answers yes or no questions :P
Use: !8ball QUESTION
Example:
<%JohnSmith> !8ball Will I win $1 million dollars?
<@uBot> Original Question: Will I win $1 million dollars? Answer:
<@uBot> Have you gone mad?! I think you have
Enjoy!
UPDATE: Fixed all the bugs :)
on *:TEXT:!8ball*:#: {
set %8ball $rand(1,11)
msg $chan Original question: $2- Answer:
if (%8ball == 1) { msg $chan No! }
if (%8ball == 2) { msg $chan Yes! }
if (%8ball == 3) { msg $chan Of course }
if (%8ball == 4) { msg $chan Have you gone mad?! I think you have }
if (%8ball == 5) { msg $chan How should I know? Its not like I'm magic }
if (%8ball == 6) { msg $chan Heck no! }
if (%8ball == 7) { msg $chan Maybe... yeah }
if (%8ball == 8) { msg $chan Why should I tell you? }
if (%8ball == 9) { msg $chan If I say yes will you be quiet? }
if (%8ball == 10) { msg $chan Yes... that will be 30 dollars }
if (%8ball == 11) { msg $chan How should I say this? Um... no }
}
You can also do it this way:
on *:TEXT:*:#: {
tokenize 32 $strip($1-)
if ($1 == !8ball) {
msg $chan Original question: $2- And the answer is:
var %x = No!|Yes!|Of course|Have you gone mad?! I think you have|$&
How should I know? Its not like I'm magic|Heck no!|Maybe... yeah|Why should I tell you?|$&
If I say yes will you be quiet?|Yes... that will be 30 dollars|How should I say this? Um... no
msg $chan $gettok(%x,$rand(1,$numtok(%x,124)),124)
}
}
This will make sure anything asked follows with the question mark at the end of a question:
on $*:TEXT:/(?<=\x3F)/S:#: {
msg $chan Original question: $strip($2-) And the answer is:
var %8ball = $rand(1,11)
if (%8ball == 1) { msg $chan No! }
if (%8ball == 2) { msg $chan Yes! }
if (%8ball == 3) { msg $chan Of course }
if (%8ball == 4) { msg $chan Have you gone mad?! I think you have }
if (%8ball == 5) { msg $chan How should I know? Its not like I'm magic }
if (%8ball == 6) { msg $chan Heck no! }
if (%8ball == 7) { msg $chan Maybe... yeah }
if (%8ball == 8) { msg $chan Why should I tell you? }
if (%8ball == 9) { msg $chan If I say yes will you be quiet? }
if (%8ball == 10) { msg $chan Yes... that will be 30 dollars }
if (%8ball == 11) { msg $chan How should I say this? Um... no }
}
Last but not least, you could have chosen the local variable instead of the global variable. This uses the same command that you've indicated.
on *:TEXT:!8ball*:#: {
set %8ball $rand(1,12)
msg $chan Original question: $2- Answer:
if(%8ball == 1) { msg $chan No! }
if(%8ball == 2) { msg $chan Yes! }
if(%8ball == 3) { msg $chan Of course }
if(%8ball == 4) { msg $chan Have you gone mad?! I think you have }
if(%8ball == 5) { msg $chan How should I know? Its not like I'm magic }
if(%8ball == 6) { msg $chan Heck no! }
if(%8ball == 7) { msg $chan Maybe... yeah }
if(%8ball == 1) { msg $chan Why should I tell you? | .timer 1 2 msg $chan BTW don't try and bribe me! }
if(%8ball == 8) { msg $chan If I say yes will you be quiet? }
if(%8ball == 9) { msg $chan Yes... that will be 30 dollars }
if(%8ball == 10) { msg $chan How should I say this? Um... no }
unset %8ball
}
Why are there so many 8balls on hawkee!!! argh! You should also use var %8ball so you dont need to unset it.
i guess you could try sockets but for purposes of this, you dont need the brackets. so like.
on *:TEXT:!8ball*:#: {
var %8ball $rand(1,12)
msg $chan Original question: $2- Answer:
if %8ball == 1 msg $chan No!
if %8ball == 2 msg $chan Yes!
if %8ball == 3 msg $chan Of course
if %8ball == 4 msg $chan Have you gone mad?! I think you have
if %8ball == 5 msg $chan How should I know? Its not like I'm magic
if %8ball == 6 msg $chan Heck no!
if %8ball == 7 msg $chan Maybe... yeah
if %8ball == 1 msg $chan Why should I tell you? | .timer 1 2 msg $chan BTW don't try and bribe me!
if %8ball == 8 msg $chan If I say yes will you be quiet?
if %8ball == 9 msg $chan Yes... that will be 30 dollars
if %8ball == 10 msg $chan How should I say this? Um... no
}
And theres your code improved and 100% working.